1
0
Fork 0

btrfs: scrub: fix target device intialization while setting up scrub 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 <clm@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
hifive-unleashed-5.1
David Sterba 2017-06-26 15:19:00 +02:00
parent bc42bda223
commit ded56184a5
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}