Skip to content

Commit 18461f2

Browse files
Ming Leiaxboe
authored andcommitted
ublk: don't fail request for recovery & reissue in case of ubq->canceling
ubq->canceling is set with request queue quiesced when io_uring context is exiting. USER_RECOVERY or !RECOVERY_FAIL_IO requires request to be re-queued and re-dispatch after device is recovered. However commit d796cea ("ublk: implement ->queue_rqs()") still may fail any request in case of ubq->canceling, this way breaks USER_RECOVERY or !RECOVERY_FAIL_IO. Fix it by calling __ublk_abort_rq() in case of ubq->canceling. Reviewed-by: Uday Shankar <ushankar@purestorage.com> Reported-by: Uday Shankar <ushankar@purestorage.com> Closes: https://lore.kernel.org/linux-block/Z%2FQkkTRHfRxtN%2FmB@dev-ushankar.dev.purestorage.com/ Fixes: d796cea ("ublk: implement ->queue_rqs()") Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250409011444.2142010-3-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6ee6bd5 commit 18461f2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/block/ublk_drv.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,8 @@ static enum blk_eh_timer_return ublk_timeout(struct request *rq)
13711371
return BLK_EH_RESET_TIMER;
13721372
}
13731373

1374-
static blk_status_t ublk_prep_req(struct ublk_queue *ubq, struct request *rq)
1374+
static blk_status_t ublk_prep_req(struct ublk_queue *ubq, struct request *rq,
1375+
bool check_cancel)
13751376
{
13761377
blk_status_t res;
13771378

@@ -1390,7 +1391,7 @@ static blk_status_t ublk_prep_req(struct ublk_queue *ubq, struct request *rq)
13901391
if (ublk_nosrv_should_queue_io(ubq) && unlikely(ubq->force_abort))
13911392
return BLK_STS_IOERR;
13921393

1393-
if (unlikely(ubq->canceling))
1394+
if (check_cancel && unlikely(ubq->canceling))
13941395
return BLK_STS_IOERR;
13951396

13961397
/* fill iod to slot in io cmd buffer */
@@ -1409,7 +1410,7 @@ static blk_status_t ublk_queue_rq(struct blk_mq_hw_ctx *hctx,
14091410
struct request *rq = bd->rq;
14101411
blk_status_t res;
14111412

1412-
res = ublk_prep_req(ubq, rq);
1413+
res = ublk_prep_req(ubq, rq, false);
14131414
if (res != BLK_STS_OK)
14141415
return res;
14151416

@@ -1441,7 +1442,7 @@ static void ublk_queue_rqs(struct rq_list *rqlist)
14411442
ublk_queue_cmd_list(ubq, &submit_list);
14421443
ubq = this_q;
14431444

1444-
if (ublk_prep_req(ubq, req) == BLK_STS_OK)
1445+
if (ublk_prep_req(ubq, req, true) == BLK_STS_OK)
14451446
rq_list_add_tail(&submit_list, req);
14461447
else
14471448
rq_list_add_tail(&requeue_list, req);

0 commit comments

Comments
 (0)