Skip to contentSkip to conversation

Clear the rest of the buffers on error

PATCH New Goldwyn Rodrigues 1 participant 1 message Mar 3, 2015 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 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.

---
 fs/ocfs2/buffer_head_io.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/ocfs2/buffer_head_io.c +6 -0
index 1edcb14..fe50ded 100644
@@ -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. */
Signature · 1 line
2.1.4