Merge tag 'ntb-4.5' of git://github.com/jonmason/ntb
[cascardo/linux.git] / fs / ocfs2 / buffer_head_io.c
index 1edcb14..fe50ded 100644 (file)
@@ -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. */