diff options
author | Omar Sandoval <osandov@fb.com> | 2019-09-16 11:30:56 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-31 16:45:50 +0100 |
commit | 60c7663ac640513e90b99f42583164691abe4aa9 (patch) | |
tree | e0181493deaf4e11c1b636a080b38a29cbe1b9e0 /fs/btrfs | |
parent | 736d28c70489e1ff2600dff2211d2b4597d8d45c (diff) | |
download | linux-stable-60c7663ac640513e90b99f42583164691abe4aa9.tar.gz linux-stable-60c7663ac640513e90b99f42583164691abe4aa9.tar.bz2 linux-stable-60c7663ac640513e90b99f42583164691abe4aa9.zip |
btrfs: don't prematurely free work in scrub_missing_raid56_worker()
[ Upstream commit 57d4f0b863272ba04ba85f86bfdc0f976f0af91c ]
Currently, scrub_missing_raid56_worker() puts and potentially frees
sblock (which embeds the work item) and then submits a bio through
scrub_wr_submit(). This is another potential instance of the bug in
"btrfs: don't prematurely free work in run_ordered_work()". Fix it by
dropping the reference after we submit the bio.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/scrub.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index f7d4e03f4c5d..a0770a6aee00 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -2149,14 +2149,13 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work) scrub_write_block_to_dev_replace(sblock); } - scrub_block_put(sblock); - if (sctx->is_dev_replace && sctx->flush_all_writes) { mutex_lock(&sctx->wr_lock); scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); } + scrub_block_put(sblock); scrub_pending_bio_dec(sctx); } |