提交 0198e5b7 编写于 作者: L Liu Bo 提交者: David Sterba

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: 6592e58c ("Btrfs: fix write corruption due to bio cloning on raid5/6")
Cc: <stable@vger.kernel.org> # v4.12-rc6+
Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 df6703e1
......@@ -1441,14 +1441,13 @@ static int fail_bio_stripe(struct btrfs_raid_bio *rbio,
*/
static void set_bio_pages_uptodate(struct bio *bio)
{
struct bio_vec bvec;
struct bvec_iter iter;
struct bio_vec *bvec;
int i;
if (bio_flagged(bio, BIO_CLONED))
bio->bi_iter = btrfs_io_bio(bio)->iter;
ASSERT(!bio_flagged(bio, BIO_CLONED));
bio_for_each_segment(bvec, bio, iter)
SetPageUptodate(bvec.bv_page);
bio_for_each_segment_all(bvec, bio, i)
SetPageUptodate(bvec->bv_page);
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册