]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm rq: don't queue request to blk-mq during DM suspend
authorMing Lei <ming.lei@redhat.com>
Thu, 23 Sep 2021 09:11:31 +0000 (17:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:58 +0000 (16:22 +0200)
commit b4459b11e84092658fa195a2587aff3b9637f0e7 upstream.

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: stable@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[Shivani: Modified to apply on 5.10.y]
Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-rq.c

index 7762bde40963eec3181b1531ed2654356f7ae0c2..a6ea77432e34caf1aaad9adca1c81f3db0bbac86 100644 (file)
@@ -490,6 +490,14 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
        struct mapped_device *md = tio->md;
        struct dm_target *ti = md->immutable_target;
 
+       /*
+        * 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.
+        */
+       if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)))
+               return BLK_STS_RESOURCE;
+
        if (unlikely(!ti)) {
                int srcu_idx;
                struct dm_table *map;