All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>,
	axboe@kernel.dk, hch@lst.de
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] zloop: clear REQ_NOWAIT before workqueue submission
Date: Wed, 19 Nov 2025 10:50:09 +0900	[thread overview]
Message-ID: <7bf811d2-257a-4be0-b65d-e255717bcd35@kernel.org> (raw)
In-Reply-To: <20251119003647.156537-2-ckulkarnilinux@gmail.com>

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

  reply	other threads:[~2025-11-19  1:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-11-19  5:41     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bf811d2-257a-4be0-b65d-e255717bcd35@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=ckulkarnilinux@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.