Skip to content

Commit 0198e5b

Browse files
Liu Bokdave
authored andcommitted
Btrfs: raid56: iterate raid56 internal bio with bio_for_each_segment_all
Bio iterated by set_bio_pages_uptodate() is raid56 internal one, so it will never be a BIO_CLONED bio, and since this is called by end_io functions, bio->bi_iter.bi_size is zero, we mustn't use bio_for_each_segment() as that is a no-op if bi_size is zero. Fixes: 6592e58 ("Btrfs: fix write corruption due to bio cloning on raid5/6") Cc: <stable@vger.kernel.org> # v4.12-rc6+ Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent df6703e commit 0198e5b

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎fs/btrfs/raid56.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,14 +1441,13 @@ static int fail_bio_stripe(struct btrfs_raid_bio *rbio,
14411441
*/
14421442
static void set_bio_pages_uptodate(struct bio *bio)
14431443
{
1444-
struct bio_vec bvec;
1445-
struct bvec_iter iter;
1444+
struct bio_vec *bvec;
1445+
int i;
14461446

1447-
if (bio_flagged(bio, BIO_CLONED))
1448-
bio->bi_iter = btrfs_io_bio(bio)->iter;
1447+
ASSERT(!bio_flagged(bio, BIO_CLONED));
14491448

1450-
bio_for_each_segment(bvec, bio, iter)
1451-
SetPageUptodate(bvec.bv_page);
1449+
bio_for_each_segment_all(bvec, bio, i)
1450+
SetPageUptodate(bvec->bv_page);
14521451
}
14531452

14541453
/*

0 commit comments

Comments
 (0)