aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/dm-core.h
diff options
context:
space:
mode:
authorGravatar Mike Snitzer <snitzer@redhat.com> 2022-02-17 23:40:02 -0500
committerGravatar Mike Snitzer <snitzer@redhat.com> 2022-02-21 15:19:08 -0500
commit9f6dc633761006f974701d4c88da71ab68670749 (patch)
treefcabdaea0e9f0c3306be15f39ee4dd9f71978c73 /drivers/md/dm-core.h
parentblock/bfq_wf2q: correct weight to ioprio (diff)
downloadlinux-9f6dc633761006f974701d4c88da71ab68670749.tar.gz
linux-9f6dc633761006f974701d4c88da71ab68670749.tar.bz2
linux-9f6dc633761006f974701d4c88da71ab68670749.zip
dm: interlock pending dm_io and dm_wait_for_bios_completion
Commit d208b89401e0 ("dm: fix mempool NULL pointer race when completing IO") didn't go far enough. When bio_end_io_acct ends the count of in-flight I/Os may reach zero and the DM device may be suspended. There is a possibility that the suspend races with dm_stats_account_io. Fix this by adding percpu "pending_io" counters to track outstanding dm_io. Move kicking of suspend queue to dm_io_dec_pending(). Also, rename md_in_flight_bios() to dm_in_flight_bios() and update it to iterate all pending_io counters. Fixes: d208b89401e0 ("dm: fix mempool NULL pointer race when completing IO") Cc: stable@vger.kernel.org Co-developed-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-core.h')
-rw-r--r--drivers/md/dm-core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h
index 72d18c3fbf1f..7ec2d75d9292 100644
--- a/drivers/md/dm-core.h
+++ b/drivers/md/dm-core.h
@@ -64,6 +64,8 @@ struct mapped_device {
struct gendisk *disk;
struct dax_device *dax_dev;
+ unsigned long __percpu *pending_io;
+
/*
* A list of ios that arrived while we were suspended.
*/