Skip to content

Commit 3423768

Browse files
Goldwyn Rodriguestorvalds
authored andcommitted
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 <[email protected]> Reviewed-by: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 17a5b9a commit 3423768

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/ocfs2/buffer_head_io.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
316316
bh = bhs[i];
317317

318318
if (!(flags & OCFS2_BH_READAHEAD)) {
319+
if (status) {
320+
/* Clear the rest of the buffers on error */
321+
put_bh(bh);
322+
bhs[i] = NULL;
323+
continue;
324+
}
319325
/* We know this can't have changed as we hold the
320326
* owner sem. Avoid doing any work on the bh if the
321327
* journal has it. */

0 commit comments

Comments
 (0)