[XFS] handle memory allocation failures during log initialisation
authorDave Chinner <david@fromorbit.com>
Mon, 10 Nov 2008 05:50:24 +0000 (16:50 +1100)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Mon, 10 Nov 2008 06:57:06 +0000 (17:57 +1100)
commit8f330f5149ef41ff943b04d914406cc417f62784
treed3e52f1cb1563c09c40768f043bfe5e487f0f142
parent6f9f51adb6ac0a49fce49e01c47dcfc2810c6e9d
[XFS] handle memory allocation failures during log initialisation

When there is no memory left in the system, xfs_buf_get_noaddr()
can fail. If this happens at mount time during xlog_alloc_log()
we fail to catch the error and oops.

Catch the error from xfs_buf_get_noaddr(), and allow other memory
allocations to fail and catch those errors too. Report the error
to the console and fail the mount with ENOMEM.

Tested by manually injecting errors into xfs_buf_get_noaddr() and
xlog_alloc_log().

Version 2:
o remove unnecessary casts of the returned pointer from kmem_zalloc()

SGI-PV: 987246

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
fs/xfs/xfs_log.c