public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix wrong condition to grab uring lock
@ 2021-10-14 14:04 Hao Xu
  2021-10-14 14:09 ` Hao Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hao Xu @ 2021-10-14 14:04 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Pavel Begunkov, Joseph Qi

Grab uring lock when we are in io-worker rather than in the original
or system-wq context since we already hold it in these two situation.

Signed-off-by: Hao Xu <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 73135c5c6168..e2ed21c65f71 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2890,7 +2890,7 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
 			struct io_ring_ctx *ctx = req->ctx;
 
 			req_set_fail(req);
-			if (issue_flags & IO_URING_F_NONBLOCK) {
+			if (!(issue_flags & IO_URING_F_NONBLOCK)) {
 				mutex_lock(&ctx->uring_lock);
 				__io_req_complete(req, issue_flags, ret, cflags);
 				mutex_unlock(&ctx->uring_lock);
-- 
2.24.4


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

* Re: [PATCH] io_uring: fix wrong condition to grab uring lock
  2021-10-14 14:04 [PATCH] io_uring: fix wrong condition to grab uring lock Hao Xu
@ 2021-10-14 14:09 ` Hao Xu
  2021-10-14 14:13 ` Pavel Begunkov
  2021-10-14 15:06 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Hao Xu @ 2021-10-14 14:09 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Pavel Begunkov, Joseph Qi

在 2021/10/14 下午10:04, Hao Xu 写道:
> Grab uring lock when we are in io-worker rather than in the original
> or system-wq context since we already hold it in these two situation.
> 
Fixes: b66ceaf324b3 ("io_uring: move iopoll reissue into regular IO path")
> Signed-off-by: Hao Xu <[email protected]>
> ---
>   fs/io_uring.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 73135c5c6168..e2ed21c65f71 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2890,7 +2890,7 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
>   			struct io_ring_ctx *ctx = req->ctx;
>   
>   			req_set_fail(req);
> -			if (issue_flags & IO_URING_F_NONBLOCK) {
> +			if (!(issue_flags & IO_URING_F_NONBLOCK)) {
>   				mutex_lock(&ctx->uring_lock);
>   				__io_req_complete(req, issue_flags, ret, cflags);
>   				mutex_unlock(&ctx->uring_lock);
> 


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

* Re: [PATCH] io_uring: fix wrong condition to grab uring lock
  2021-10-14 14:04 [PATCH] io_uring: fix wrong condition to grab uring lock Hao Xu
  2021-10-14 14:09 ` Hao Xu
@ 2021-10-14 14:13 ` Pavel Begunkov
  2021-10-14 15:06 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-10-14 14:13 UTC (permalink / raw)
  To: Hao Xu, Jens Axboe; +Cc: io-uring, Joseph Qi

On 10/14/21 15:04, Hao Xu wrote:
> Grab uring lock when we are in io-worker rather than in the original
> or system-wq context since we already hold it in these two situation.

Good catch, lgtm


> Signed-off-by: Hao Xu <[email protected]>
> ---
>   fs/io_uring.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 73135c5c6168..e2ed21c65f71 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2890,7 +2890,7 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
>   			struct io_ring_ctx *ctx = req->ctx;
>   
>   			req_set_fail(req);
> -			if (issue_flags & IO_URING_F_NONBLOCK) {
> +			if (!(issue_flags & IO_URING_F_NONBLOCK)) {
>   				mutex_lock(&ctx->uring_lock);
>   				__io_req_complete(req, issue_flags, ret, cflags);
>   				mutex_unlock(&ctx->uring_lock);
> 

-- 
Pavel Begunkov

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

* Re: [PATCH] io_uring: fix wrong condition to grab uring lock
  2021-10-14 14:04 [PATCH] io_uring: fix wrong condition to grab uring lock Hao Xu
  2021-10-14 14:09 ` Hao Xu
  2021-10-14 14:13 ` Pavel Begunkov
@ 2021-10-14 15:06 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-10-14 15:06 UTC (permalink / raw)
  To: Hao Xu; +Cc: Jens Axboe, io-uring, Joseph Qi, Pavel Begunkov

On Thu, 14 Oct 2021 22:04:00 +0800, Hao Xu wrote:
> Grab uring lock when we are in io-worker rather than in the original
> or system-wq context since we already hold it in these two situation.
> 
> 

Applied, thanks!

[1/1] io_uring: fix wrong condition to grab uring lock
      commit: 14cfbb7a7856f190035f8e53045bdbfa648fae41

Best regards,
-- 
Jens Axboe



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

end of thread, other threads:[~2021-10-14 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-14 14:04 [PATCH] io_uring: fix wrong condition to grab uring lock Hao Xu
2021-10-14 14:09 ` Hao Xu
2021-10-14 14:13 ` Pavel Begunkov
2021-10-14 15:06 ` Jens Axboe

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