* [PATCH V2 1/2] loop: clear nowait flag in workqueue context
@ 2025-11-19 23:22 Chaitanya Kulkarni
2025-11-19 23:22 ` [PATCH V2 2/2] zloop: " Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2025-11-19 23:22 UTC (permalink / raw)
To: axboe, dlemoal, hch; +Cc: linux-block, Chaitanya Kulkarni
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>
---
v1->v2:-
Unset REQ_NOWAIT at the start of the workqueue context. (Damien)
HEAD:-
commit 6dbcc40ec7aa17ed3dd1f798e4201e75ab7d7447 (HEAD -> for-next, origin/for-next)
Merge: 58625d626327 ba13710ddd1f
Author: Jens Axboe <axboe@kernel.dk>
Date: Wed Nov 5 18:24:17 2025 -0700
Merge branch 'for-6.19/block' into for-next
* for-6.19/block:
rust: block: update ARef and AlwaysRefCounted imports from sync::aref
---
drivers/block/loop.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 13ce229d450c..ebe751f39742 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1908,6 +1908,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)
--
2.40.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V2 2/2] zloop: clear nowait flag in workqueue context
2025-11-19 23:22 [PATCH V2 1/2] loop: clear nowait flag in workqueue context Chaitanya Kulkarni
@ 2025-11-19 23:22 ` Chaitanya Kulkarni
2025-11-20 2:04 ` Damien Le Moal
2025-11-20 2:03 ` [PATCH V2 1/2] loop: " Damien Le Moal
2025-11-20 14:52 ` Jens Axboe
2 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2025-11-19 23:22 UTC (permalink / raw)
To: axboe, dlemoal, hch; +Cc: linux-block, Chaitanya Kulkarni
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>
---
v1->v2:-
Unset REQ_NOWAIT at the start of the workqueue context. (Damien)
HEAD:-
commit 6dbcc40ec7aa17ed3dd1f798e4201e75ab7d7447 (HEAD -> for-next, origin/for-next)
Merge: 58625d626327 ba13710ddd1f
Author: Jens Axboe <axboe@kernel.dk>
Date: Wed Nov 5 18:24:17 2025 -0700
Merge branch 'for-6.19/block' into for-next
* for-6.19/block:
rust: block: update ARef and AlwaysRefCounted imports from sync::aref
---
drivers/block/zloop.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 92be9f0af00a..1a97b21f5fed 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -498,6 +498,10 @@ static void zloop_handle_cmd(struct zloop_cmd *cmd)
struct request *rq = blk_mq_rq_from_pdu(cmd);
struct zloop_device *zlo = rq->q->queuedata;
+ /* We can block in this context, so ignore REQ_NOWAIT. */
+ if (rq->cmd_flags & REQ_NOWAIT)
+ rq->cmd_flags &= ~REQ_NOWAIT;
+
switch (req_op(rq)) {
case REQ_OP_READ:
case REQ_OP_WRITE:
--
2.40.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] loop: clear nowait flag in workqueue context
2025-11-19 23:22 [PATCH V2 1/2] loop: clear nowait flag in workqueue context Chaitanya Kulkarni
2025-11-19 23:22 ` [PATCH V2 2/2] zloop: " Chaitanya Kulkarni
@ 2025-11-20 2:03 ` Damien Le Moal
2025-11-20 14:52 ` Jens Axboe
2 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2025-11-20 2:03 UTC (permalink / raw)
To: Chaitanya Kulkarni, axboe, hch; +Cc: linux-block
On 11/20/25 8:22 AM, Chaitanya Kulkarni wrote:
> 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>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 2/2] zloop: clear nowait flag in workqueue context
2025-11-19 23:22 ` [PATCH V2 2/2] zloop: " Chaitanya Kulkarni
@ 2025-11-20 2:04 ` Damien Le Moal
0 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2025-11-20 2:04 UTC (permalink / raw)
To: Chaitanya Kulkarni, axboe, hch; +Cc: linux-block
On 11/20/25 8:22 AM, Chaitanya Kulkarni wrote:
> 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>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] loop: clear nowait flag in workqueue context
2025-11-19 23:22 [PATCH V2 1/2] loop: clear nowait flag in workqueue context Chaitanya Kulkarni
2025-11-19 23:22 ` [PATCH V2 2/2] zloop: " Chaitanya Kulkarni
2025-11-20 2:03 ` [PATCH V2 1/2] loop: " Damien Le Moal
@ 2025-11-20 14:52 ` Jens Axboe
2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-11-20 14:52 UTC (permalink / raw)
To: dlemoal, hch, Chaitanya Kulkarni; +Cc: linux-block
On Wed, 19 Nov 2025 15:22:33 -0800, Chaitanya Kulkarni wrote:
> 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.
>
> [...]
Applied, thanks!
[1/2] loop: clear nowait flag in workqueue context
commit: b11e483a1cc32e7b557ff680e9bfb4ff11dea9c1
[2/2] zloop: clear nowait flag in workqueue context
commit: e8f0abdd49baacee3886d5827f113514fcd9fd05
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-20 14:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 23:22 [PATCH V2 1/2] loop: clear nowait flag in workqueue context Chaitanya Kulkarni
2025-11-19 23:22 ` [PATCH V2 2/2] zloop: " Chaitanya Kulkarni
2025-11-20 2:04 ` Damien Le Moal
2025-11-20 2:03 ` [PATCH V2 1/2] loop: " Damien Le Moal
2025-11-20 14:52 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).