[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 05:50:24 +0000 (16:50 +1100)
commit644c3567d16b7e53cf52ae98c4150d601c9eacfe
treee3081a3e1147c07d456b7e1e8b34fd3f3b11275d
parentdcd7b4e5c0649b1d2219399529b20de1df517e55
[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