Btrfs: update bi_remaining to relfect our bio endio chaining
Subsystems (3)
PATCH 1/1 Btrfs: update bi_remaining to relfect our bio endio chaining
Btrfs is sometimes calling bio_endio twice on the same bio while we chain things. This makes sure we don't trip over new assertions in fs/bio.c
Signed-off-by Chris Mason <[email protected]>
fs/btrfs/check-integrity.c +4 -0
@@ -2289,6 +2289,10 @@ static void btrfsic_bio_end_io(struct bio *bp, int bio_error_status) block = next_block; }while (NULL != block); +/* +* since we're not using bio_endio here, we don't need to worry about +* the remaining count +*/ bp->bi_end_io (bp, bio_error_status); }
fs/btrfs/disk-io.c +1 -1
@@ -1684,7 +1684,7 @@ static void end_workqueue_fn(struct btrfs_work *work) bio->bi_private = end_io_wq->private; bio->bi_end_io = end_io_wq->end_io;kfree (end_io_wq); -bio_endio (bio, error); +bio_endio_nodec (bio, error); }static int cleaner_kthread (void *arg)
fs/btrfs/volumes.c +9 -1
@@ -5284,9 +5284,17 @@ static void btrfs_end_bio(struct bio *bio, int err) } } -if (bio == bbio->orig_bio) +if (bio == bbio->orig_bio) { is_orig_bio =1 ; +/* +* eventually we will call the bi_endio for the original bio, +* make sure that we've properly bumped bi_remaining to reflect +* our chain of endios here +*/ +atomic_inc (&bio->bi_remaining); + } +if (atomic_dec_and_test (&bbio->stripes_pending)) {if (!is_orig_bio) {bio_put (bio);
Quoted 5 lines · Chris Mason
Btrfs is sometimes calling
bio_endiotwice on the same bio while we chain things. This makes sure we don't trip over new assertions infs/bio.cSigned-off-by Chris Mason <[email protected]>
Beat me to it :P
Tested-by Kent Overstreet <[email protected]>