提交 c7b22bb1 编写于 作者: M Muthu Kumar 提交者: Jens Axboe

btrfs: fix missing increment of bi_remaining

In btrfs_end_bio(), we increment bi_remaining if is_orig_bio. If not,
we restore the orig_bio but failed to increment bi_remaining for
orig_bio, which triggers a BUG_ON later when bio_endio is called. Fix
is to increment bi_remaining when we restore the orig bio as well.
Reported-by: NFengguang Wu <fengguang.wu@intel.com>
CC: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: NMuthukumar Ratty <muthur@gmail.com>
Reviewed-by: NChris Mason <clm@fb.com>
Tested-by: NFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 1331107f
...@@ -5297,9 +5297,14 @@ static void btrfs_end_bio(struct bio *bio, int err) ...@@ -5297,9 +5297,14 @@ static void btrfs_end_bio(struct bio *bio, int err)
if (!is_orig_bio) { if (!is_orig_bio) {
bio_put(bio); bio_put(bio);
bio = bbio->orig_bio; bio = bbio->orig_bio;
} else {
atomic_inc(&bio->bi_remaining);
} }
/*
* We have original bio now. So increment bi_remaining to
* account for it in endio
*/
atomic_inc(&bio->bi_remaining);
bio->bi_private = bbio->private; bio->bi_private = bbio->private;
bio->bi_end_io = bbio->end_io; bio->bi_end_io = bbio->end_io;
btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; btrfs_io_bio(bio)->mirror_num = bbio->mirror_num;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册