]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm mpath: requeue after a small delay if blk_get_request() fails
authorBart Van Assche <bart.vanassche@sandisk.com>
Fri, 7 Apr 2017 23:50:44 +0000 (16:50 -0700)
committerMike Snitzer <snitzer@redhat.com>
Mon, 24 Apr 2017 19:06:19 +0000 (15:06 -0400)
If blk_get_request() returns ENODEV then multipath_clone_and_map()
causes a request to be requeued immediately. This can cause a kworker
thread to spend 100% of the CPU time of a single core in
__blk_mq_run_hw_queue() and also can cause device removal to never
finish.

Avoid this by only requeuing after a delay if blk_get_request() fails.
Additionally, reduce the requeue delay.

Cc: stable@vger.kernel.org # 4.9+
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-mpath.c
drivers/md/dm-rq.c

index 7f223dbed49f61d5797d4edba728989c9e435d3d..a4cc4d42117b3b460ae69b25b3d760b825671a21 100644 (file)
@@ -484,7 +484,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
                                   struct request **__clone)
 {
        struct multipath *m = ti->private;
-       int r = DM_MAPIO_REQUEUE;
        size_t nr_bytes = blk_rq_bytes(rq);
        struct pgpath *pgpath;
        struct block_device *bdev;
@@ -503,7 +502,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
        } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) ||
                   test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) {
                pg_init_all_paths(m);
-               return r;
+               return DM_MAPIO_REQUEUE;
        }
 
        memset(mpio, 0, sizeof(*mpio));
@@ -517,7 +516,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
                        GFP_ATOMIC);
        if (IS_ERR(clone)) {
                /* EBUSY, ENODEV or EWOULDBLOCK: requeue */
-               return r;
+               return DM_MAPIO_DELAY_REQUEUE;
        }
        clone->bio = clone->biotail = NULL;
        clone->rq_disk = bdev->bd_disk;
index 28955b94d2b26f47d7c54217d84c2a8a11af692a..90756a56c4d383cdbc2e0a1ff728c1c479600b8a 100644 (file)
@@ -280,7 +280,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_
        if (!rq->q->mq_ops)
                dm_old_requeue_request(rq);
        else
-               dm_mq_delay_requeue_request(rq, delay_requeue ? 5000 : 0);
+               dm_mq_delay_requeue_request(rq, delay_requeue ? 100/*ms*/ : 0);
 
        rq_completed(md, rw, false);
 }