diff options
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 37972d5db737..54d2685a3071 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5297,9 +5297,14 @@ static void btrfs_end_bio(struct bio *bio, int err) if (!is_orig_bio) { bio_put(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_end_io = bbio->end_io; btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; |