From: Goldwyn Rodrigues Date: Tue, 7 Apr 2015 23:43:57 +0000 (+1000) Subject: ocfs2: clear the rest of the buffers on error X-Git-Tag: KARO-TXA5-2015-06-26~18^2~465 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fab1972d848114d8244c82f101b348743b262ddc;p=karo-tx-linux.git ocfs2: clear the rest of the buffers on error In case a validation fails, clear the rest of the buffers and return the error to the calling function. This also facilitates bubbling up the error originating from ocfs2_error to calling functions. Signed-off-by: Goldwyn Rodrigues Cc: Mark Fasheh Cc: Joel Becker Signed-off-by: Andrew Morton --- diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index 1edcb141f639..fe50ded1b4ce 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c @@ -316,6 +316,12 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, bh = bhs[i]; if (!(flags & OCFS2_BH_READAHEAD)) { + if (status) { + /* Clear the rest of the buffers on error */ + put_bh(bh); + bhs[i] = NULL; + continue; + } /* We know this can't have changed as we hold the * owner sem. Avoid doing any work on the bh if the * journal has it. */