loop: clear nowait flag in workqueue context

The loop driver advertises REQ_NOWAIT support through BLK_FEAT_NOWAIT
(enabled by default for all blk-mq devices), and honors the nowait
behavior throughout loop_queue_rq().

However, actual I/O to the backing file is performed in a workqueue,
where blocking is allowed.

To avoid imposing unnecessary non-blocking constraints in this blocking
context, clear the REQ_NOWAIT flag before processing the request in the
workqueue context.

Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Chaitanya Kulkarni 2025-11-19 15:22:33 -08:00 committed by Jens Axboe
parent a9637ab93c
commit b11e483a1c
1 changed files with 4 additions and 0 deletions

View File

@ -2060,6 +2060,10 @@ static void loop_handle_cmd(struct loop_cmd *cmd)
goto failed;
}
/* We can block in this context, so ignore REQ_NOWAIT. */
if (rq->cmd_flags & REQ_NOWAIT)
rq->cmd_flags &= ~REQ_NOWAIT;
if (cmd_blkcg_css)
kthread_associate_blkcg(cmd_blkcg_css);
if (cmd_memcg_css)