Skip to content

Commit d16919a

Browse files
Liu Bogregkh
authored andcommitted
Btrfs: raid56: iterate raid56 internal bio with bio_for_each_segment_all
commit 0198e5b upstream. 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") Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e06f7b6 commit d16919a

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
@@ -1432,14 +1432,13 @@ static int fail_bio_stripe(struct btrfs_raid_bio *rbio,
14321432
*/
14331433
static void set_bio_pages_uptodate(struct bio *bio)
14341434
{
1435-
struct bio_vec bvec;
1436-
struct bvec_iter iter;
1435+
struct bio_vec *bvec;
1436+
int i;
14371437

1438-
if (bio_flagged(bio, BIO_CLONED))
1439-
bio->bi_iter = btrfs_io_bio(bio)->iter;
1438+
ASSERT(!bio_flagged(bio, BIO_CLONED));
14401439

1441-
bio_for_each_segment(bvec, bio, iter)
1442-
SetPageUptodate(bvec.bv_page);
1440+
bio_for_each_segment_all(bvec, bio, i)
1441+
SetPageUptodate(bvec->bv_page);
14431442
}
14441443

14451444
/*

0 commit comments

Comments
 (0)