Skip to content

Commit

Permalink
btrfs: scrub: fix target device intialization while setting up scrub …
Browse files Browse the repository at this point in the history
…context

The commit "btrfs: scrub: inline helper scrub_setup_wr_ctx" inlined a
helper but wrongly sets up the target device. Incidentally there's a
local variable with the same name as a parameter in the previous
function, so this got caught during runtime as crash in test btrfs/027.

Reported-by: Chris Mason <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Jun 29, 2017
1 parent bc42bda commit ded5618
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,9 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace)
mutex_init(&sctx->wr_lock);
sctx->wr_curr_bio = NULL;
if (is_dev_replace) {
WARN_ON(!dev->bdev);
WARN_ON(!fs_info->dev_replace.tgtdev);
sctx->pages_per_wr_bio = SCRUB_PAGES_PER_WR_BIO;
sctx->wr_tgtdev = dev;
sctx->wr_tgtdev = fs_info->dev_replace.tgtdev;
atomic_set(&sctx->flush_all_writes, 0);
}

Expand Down

0 comments on commit ded5618

Please sign in to comment.