* [PATCH 1/2] loop: clear REQ_NOWAIT before workqueue submission
@ 2025-11-19 0:36 Chaitanya Kulkarni
2025-11-19 0:36 ` [PATCH 2/2] zloop: " Chaitanya Kulkarni
0 siblings, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2025-11-19 0:36 UTC (permalink / raw)
To: axboe, dlemoal, hch; +Cc: linux-block, Chaitanya Kulkarni
loop advertises REQ_NOWAIT support via BLK_FEAT_NOWAIT (set by default
for all blk-mq devices), but delegates I/O processing to workqueues
where blocking operations are allowed.
Since REQ_NOWAIT is not valid in the workqueue context, clear the
REQ_NOWAIT flag before handing the request over to the workqueue. This
avoids unnecessary non-blocking constraints in a context where blocking
is acceptable.
Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
---
Hi,
Patches are generated on base commit in linux-block/for-next :-
commit 6dbcc40ec7aa17ed3dd1f798e4201e75ab7d7447 (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
-ck
---
drivers/block/loop.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 13ce229d450c..9d931ff456e7 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -797,6 +797,7 @@ static inline int queue_on_root_worker(struct cgroup_subsys_state *css)
static void loop_queue_work(struct loop_device *lo, struct loop_cmd *cmd)
{
+ struct request *rq = blk_mq_rq_from_pdu(cmd);
struct rb_node **node, *parent = NULL;
struct loop_worker *cur_worker, *worker = NULL;
struct work_struct *work;
@@ -860,6 +861,9 @@ static void loop_queue_work(struct loop_device *lo, struct loop_cmd *cmd)
work = &lo->rootcg_work;
cmd_list = &lo->rootcg_cmd_list;
}
+
+ rq->cmd_flags &= ~REQ_NOWAIT;
+
list_add_tail(&cmd->list_entry, cmd_list);
queue_work(lo->workqueue, work);
spin_unlock_irq(&lo->lo_work_lock);
--
2.40.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] zloop: clear REQ_NOWAIT before workqueue submission
2025-11-19 0:36 [PATCH 1/2] loop: clear REQ_NOWAIT before workqueue submission Chaitanya Kulkarni
@ 2025-11-19 0:36 ` Chaitanya Kulkarni
2025-11-19 1:50 ` Damien Le Moal
0 siblings, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2025-11-19 0:36 UTC (permalink / raw)
To: axboe, dlemoal, hch; +Cc: linux-block, Chaitanya Kulkarni
zloop advertises REQ_NOWAIT support via BLK_FEAT_NOWAIT (set by default
for all blk-mq devices), but delegates I/O processing to workqueues
where blocking operations are allowed.
Since REQ_NOWAIT is not valid in the workqueue context, clear the
REQ_NOWAIT flag before handing the request over to the workqueue. This
avoids unnecessary non-blocking constraints in a context where blocking
is acceptable.
Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
---
drivers/block/zloop.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 92be9f0af00a..22a245259622 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -620,6 +620,8 @@ static blk_status_t zloop_queue_rq(struct blk_mq_hw_ctx *hctx,
blk_mq_start_request(rq);
+ rq->cmd_flags &= ~REQ_NOWAIT;
+
INIT_WORK(&cmd->work, zloop_cmd_workfn);
queue_work(zlo->workqueue, &cmd->work);
--
2.40.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] zloop: clear REQ_NOWAIT before workqueue submission
2025-11-19 0:36 ` [PATCH 2/2] zloop: " Chaitanya Kulkarni
@ 2025-11-19 1:50 ` Damien Le Moal
2025-11-19 5:41 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Damien Le Moal @ 2025-11-19 1:50 UTC (permalink / raw)
To: Chaitanya Kulkarni, axboe, hch; +Cc: linux-block
On 11/19/25 09:36, Chaitanya Kulkarni wrote:
> zloop advertises REQ_NOWAIT support via BLK_FEAT_NOWAIT (set by default
> for all blk-mq devices), but delegates I/O processing to workqueues
> where blocking operations are allowed.
>
> Since REQ_NOWAIT is not valid in the workqueue context, clear the
> REQ_NOWAIT flag before handing the request over to the workqueue. This
> avoids unnecessary non-blocking constraints in a context where blocking
> is acceptable.
>
> Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
> ---
> drivers/block/zloop.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
> index 92be9f0af00a..22a245259622 100644
> --- a/drivers/block/zloop.c
> +++ b/drivers/block/zloop.c
> @@ -620,6 +620,8 @@ static blk_status_t zloop_queue_rq(struct blk_mq_hw_ctx *hctx,
>
> blk_mq_start_request(rq);
>
> + rq->cmd_flags &= ~REQ_NOWAIT;
> +
To be able to catch any potential issue with this function blocking, I think it
is preferable to unset REQ_NOWAIT only once we are in the context of the worker
thread.
So something like this:
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index d6dc672bda5f..9e4256824336 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -547,6 +547,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:
The same comment applies to loop as well. I think it is better to clear
REQ_NOWAIT only once the request is owned by the worker thread context.
--
Damien Le Moal
Western Digital Research
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] zloop: clear REQ_NOWAIT before workqueue submission
2025-11-19 1:50 ` Damien Le Moal
@ 2025-11-19 5:41 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2025-11-19 5:41 UTC (permalink / raw)
To: Damien Le Moal; +Cc: Chaitanya Kulkarni, axboe, hch, linux-block
On Wed, Nov 19, 2025 at 10:50:09AM +0900, Damien Le Moal wrote:
> To be able to catch any potential issue with this function blocking, I think it
> is preferable to unset REQ_NOWAIT only once we are in the context of the worker
> thread.
...
> The same comment applies to loop as well. I think it is better to clear
> REQ_NOWAIT only once the request is owned by the worker thread context.
Agreed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-19 5:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 0:36 [PATCH 1/2] loop: clear REQ_NOWAIT before workqueue submission Chaitanya Kulkarni
2025-11-19 0:36 ` [PATCH 2/2] zloop: " Chaitanya Kulkarni
2025-11-19 1:50 ` Damien Le Moal
2025-11-19 5:41 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.