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

zloop: clear nowait flag in workqueue context

The zloop driver advertises REQ_NOWAIT support through BLK_FEAT_NOWAIT
(enabled by default for all blk-mq devices), and honors the nowait
behavior throughout zloop_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
e8f0abdd b11e483a

+4
+4
drivers/block/zloop.c
··· 548 548 struct request *rq = blk_mq_rq_from_pdu(cmd); 549 549 struct zloop_device *zlo = rq->q->queuedata; 550 550 551 + /* We can block in this context, so ignore REQ_NOWAIT. */ 552 + if (rq->cmd_flags & REQ_NOWAIT) 553 + rq->cmd_flags &= ~REQ_NOWAIT; 554 + 551 555 switch (req_op(rq)) { 552 556 case REQ_OP_READ: 553 557 case REQ_OP_WRITE: