summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2018-12-11 09:10:26 -0500
committerJens Axboe <axboe@kernel.dk>2018-12-11 07:40:02 -0700
commitc4576aed8d85d808cd6443bda58393d525207d01 (patch)
tree909ff78658e5c82da4e8d575da1457dcaccd79bd /drivers/md/dm.c
parent6451fe73fa0f542a49bfacd7205b88a597897f58 (diff)
downloadlinux-c4576aed8d85d808cd6443bda58393d525207d01.tar.gz
linux-c4576aed8d85d808cd6443bda58393d525207d01.tar.bz2
linux-c4576aed8d85d808cd6443bda58393d525207d01.zip
dm: fix request-based dm's use of dm_wait_for_completion
The md->wait waitqueue is used by both bio-based and request-based DM. Commit dbd3bbd291 ("dm rq: leverage blk_mq_queue_busy() to check for outstanding IO") lost sight of the requirement that dm_wait_for_completion() must work with all types of DM devices. Fix md_in_flight() to call the blk-mq or bio-based method accordingly. Fixes: dbd3bbd291 ("dm rq: leverage blk_mq_queue_busy() to check for outstanding IO") Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 79ad4b3d215c..c414d40d645d 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -646,7 +646,7 @@ static void free_tio(struct dm_target_io *tio)
bio_put(&tio->clone);
}
-static bool md_in_flight(struct mapped_device *md)
+static bool md_in_flight_bios(struct mapped_device *md)
{
int cpu;
struct hd_struct *part = &dm_disk(md)->part0;
@@ -660,6 +660,14 @@ static bool md_in_flight(struct mapped_device *md)
return sum != 0;
}
+static bool md_in_flight(struct mapped_device *md)
+{
+ if (queue_is_mq(md->queue))
+ return blk_mq_queue_busy(md->queue);
+ else
+ return md_in_flight_bios(md);
+}
+
static void start_io_acct(struct dm_io *io)
{
struct mapped_device *md = io->md;