Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chaitanya Kulkarni and committed by
Jens Axboe
b11e483a a9637ab9

+4
+4
drivers/block/loop.c
··· 2060 2060 goto failed; 2061 2061 } 2062 2062 2063 + /* We can block in this context, so ignore REQ_NOWAIT. */ 2064 + if (rq->cmd_flags & REQ_NOWAIT) 2065 + rq->cmd_flags &= ~REQ_NOWAIT; 2066 + 2063 2067 if (cmd_blkcg_css) 2064 2068 kthread_associate_blkcg(cmd_blkcg_css); 2065 2069 if (cmd_memcg_css)