ublk: don't get ublk device reference in ublk_abort_queue()
authorMing Lei <ming.lei@redhat.com>
Mon, 9 Oct 2023 09:33:16 +0000 (17:33 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 17 Oct 2023 14:27:55 +0000 (08:27 -0600)
ublk_abort_queue() is called in ublk_daemon_monitor_work(), in which
it is guaranteed that the device is live because monitor work is
canceled when removing device, so no need to get the device reference.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20231009093324.957829-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c

index b0bbda08ad453c782a79dc0eeb020b6d4e02ee07..59d3652699f596f9461c1fac03fa34d90f4444cb 100644 (file)
@@ -1420,9 +1420,6 @@ static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq)
 {
        int i;
 
-       if (!ublk_get_device(ub))
-               return;
-
        for (i = 0; i < ubq->q_depth; i++) {
                struct ublk_io *io = &ubq->ios[i];
 
@@ -1438,7 +1435,6 @@ static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq)
                                __ublk_fail_req(ubq, io, rq);
                }
        }
-       ublk_put_device(ub);
 }
 
 static void ublk_daemon_monitor_work(struct work_struct *work)