Skip to content

Commit c4576ae

Browse files
snitmaxboe
authored andcommitted
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 dbd3bbd ("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: dbd3bbd ("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>
1 parent 6451fe7 commit c4576ae

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

drivers/md/dm-rq.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig)
131131
static void rq_completed(struct mapped_device *md, int rw, bool run_queue)
132132
{
133133
/* nudge anyone waiting on suspend queue */
134-
if (unlikely(waitqueue_active(&md->wait))) {
135-
if (!blk_mq_queue_busy(md->queue))
136-
wake_up(&md->wait);
137-
}
134+
if (unlikely(waitqueue_active(&md->wait)))
135+
wake_up(&md->wait);
138136

139137
/*
140138
* dm_put() must be at the end of this function. See the comment above

drivers/md/dm.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ static void free_tio(struct dm_target_io *tio)
646646
bio_put(&tio->clone);
647647
}
648648

649-
static bool md_in_flight(struct mapped_device *md)
649+
static bool md_in_flight_bios(struct mapped_device *md)
650650
{
651651
int cpu;
652652
struct hd_struct *part = &dm_disk(md)->part0;
@@ -660,6 +660,14 @@ static bool md_in_flight(struct mapped_device *md)
660660
return sum != 0;
661661
}
662662

663+
static bool md_in_flight(struct mapped_device *md)
664+
{
665+
if (queue_is_mq(md->queue))
666+
return blk_mq_queue_busy(md->queue);
667+
else
668+
return md_in_flight_bios(md);
669+
}
670+
663671
static void start_io_acct(struct dm_io *io)
664672
{
665673
struct mapped_device *md = io->md;

0 commit comments

Comments
 (0)