public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ublk: honor IO_URING_F_NONBLOCK for handling control command
@ 2023-01-04 13:32 Ming Lei
  2023-01-04 16:13 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2023-01-04 13:32 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, ZiyangZhang, Ming Lei

Most of control command handlers may sleep, so return -EAGAIN in case
of IO_URING_F_NONBLOCK to defer the handling into io wq context.

Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/block/ublk_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index e9de9d846b73..17b677b5d3b2 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1992,6 +1992,9 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
 	struct ublksrv_ctrl_cmd *header = (struct ublksrv_ctrl_cmd *)cmd->cmd;
 	int ret = -EINVAL;
 
+	if (issue_flags & IO_URING_F_NONBLOCK)
+		return -EAGAIN;
+
 	ublk_ctrl_cmd_dump(cmd);
 
 	if (!(issue_flags & IO_URING_F_SQE128))
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ublk: honor IO_URING_F_NONBLOCK for handling control command
  2023-01-04 13:32 [PATCH] ublk: honor IO_URING_F_NONBLOCK for handling control command Ming Lei
@ 2023-01-04 16:13 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2023-01-04 16:13 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-block, ZiyangZhang


On Wed, 04 Jan 2023 21:32:35 +0800, Ming Lei wrote:
> Most of control command handlers may sleep, so return -EAGAIN in case
> of IO_URING_F_NONBLOCK to defer the handling into io wq context.
> 
> 

Applied, thanks!

[1/1] ublk: honor IO_URING_F_NONBLOCK for handling control command
      commit: 6a894753cef6494feb7e5332a95477f31212ebe9

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-04 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 13:32 [PATCH] ublk: honor IO_URING_F_NONBLOCK for handling control command Ming Lei
2023-01-04 16:13 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox