Skip to content

Commit b4459b1

Browse files
Ming Leisnitm
authored andcommitted
dm rq: don't queue request to blk-mq during DM suspend
DM uses blk-mq's quiesce/unquiesce to stop/start device mapper queue. But blk-mq's unquiesce may come from outside events, such as elevator switch, updating nr_requests or others, and request may come during suspend, so simply ask for blk-mq to requeue it. Fixes one kernel panic issue when running updating nr_requests and dm-mpath suspend/resume stress test. Cc: [email protected] Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent ec132ef commit b4459b1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/md/dm-rq.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,14 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
490490
struct mapped_device *md = tio->md;
491491
struct dm_target *ti = md->immutable_target;
492492

493+
/*
494+
* blk-mq's unquiesce may come from outside events, such as
495+
* elevator switch, updating nr_requests or others, and request may
496+
* come during suspend, so simply ask for blk-mq to requeue it.
497+
*/
498+
if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)))
499+
return BLK_STS_RESOURCE;
500+
493501
if (unlikely(!ti)) {
494502
int srcu_idx;
495503
struct dm_table *map = dm_get_live_table(md, &srcu_idx);

0 commit comments

Comments
 (0)