Skip to content

Commit b11e483

Browse files
ChaitanayaKulkarniaxboe
authored andcommitted
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>
1 parent a9637ab commit b11e483

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/block/loop.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,10 @@ static void loop_handle_cmd(struct loop_cmd *cmd)
20602060
goto failed;
20612061
}
20622062

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+
20632067
if (cmd_blkcg_css)
20642068
kthread_associate_blkcg(cmd_blkcg_css);
20652069
if (cmd_memcg_css)

0 commit comments

Comments
 (0)