Skip to content

Commit 38c1c2e

Browse files
Liu Bomasoncl
authored andcommitted
Btrfs: fix crash on endio of reading corrupted block
The crash is ------------[ cut here ]------------ kernel BUG at fs/btrfs/extent_io.c:2124! [...] Workqueue: btrfs-endio normal_work_helper [btrfs] RIP: 0010:[<ffffffffa02d6055>] [<ffffffffa02d6055>] end_bio_extent_readpage+0xb45/0xcd0 [btrfs] This is in fact a regression. It is because we forgot to increase @offset properly in reading corrupted block, so that the @offset remains, and this leads to checksum errors while reading left blocks queued up in the same bio, and then ends up with hiting the above BUG_ON. Reported-by: Chris Murphy <[email protected]> Signed-off-by: Liu Bo <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent a3c1089 commit 38c1c2e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/extent_io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
25322532
test_bit(BIO_UPTODATE, &bio->bi_flags);
25332533
if (err)
25342534
uptodate = 0;
2535+
offset += len;
25352536
continue;
25362537
}
25372538
}

0 commit comments

Comments
 (0)