mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kbuild test robot <lkp@intel.com>
Subject: Re: [PATCH v2] io_uring: Fix reversed nonblock flag
Date: Fri, 4 Oct 2019 16:58:49 +0300	[thread overview]
Message-ID: <d3e3b157-c8e7-0e75-099d-9ceea6659bf8@gmail.com> (raw)
In-Reply-To: <7a18d7d7-323a-5903-2952-814954910ddd@kernel.dk>


[-- Attachment #1.1: Type: text/plain, Size: 2197 bytes --]

On 04/10/2019 16:05, Jens Axboe wrote:
> On 10/4/19 4:07 AM, Pavel Begunkov (Silence) wrote:
>> From: Pavel Begunkov <asml.silence@gmail.com>
>>
>> io_queue_link_head() accepts @force_nonblock flag, but io_ring_submit()
>> passes something opposite.
>>
>> v2: fix build error by test robot: Rebase from custom tree
>> Reported-by: kbuild test robot <lkp@intel.com>
>>
>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>> ---
>>   fs/io_uring.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index c934f91c51e9..c909ea2b84e9 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -2703,6 +2703,7 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit,
>>   	struct io_kiocb *shadow_req = NULL;
>>   	bool prev_was_link = false;
>>   	int i, submit = 0;
>> +	bool force_nonblock = true;
>>   
>>   	if (to_submit > IO_PLUG_THRESHOLD) {
>>   		io_submit_state_start(&state, ctx, to_submit);
>> @@ -2710,9 +2711,9 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit,
>>   	}
>>   
>>   	for (i = 0; i < to_submit; i++) {
>> -		bool force_nonblock = true;
>>   		struct sqe_submit s;
>>   
>> +		force_nonblock = true;
>>   		if (!io_get_sqring(ctx, &s))
>>   			break;
>>   
>> @@ -2761,7 +2762,7 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit,
>>   
>>   	if (link)
>>   		io_queue_link_head(ctx, link, &link->submit, shadow_req,
>> -					block_for_last);
>> +					force_nonblock);
>>   	if (statep)
>>   		io_submit_state_end(statep);
> 
> Shouldn't this just be:
> 
>    		io_queue_link_head(ctx, link, &link->submit, shadow_req,
>  					!block_for_last);
> 
> We're outside the loop, so by definition at the end of what we need to
> do. We don't need to factor in the fiddling of force_nonblock here,
> it'll be false at this point anyway. Only exception is error handling,
> if the caller asked for more than what was in the ring. Not a big
> deal...

Thanks for explaining this, I'll resend.
Played safe because of breaks in the loop.

-- 
Yours sincerely,
Pavel Begunkov


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-10-04 13:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04  8:25 [PATCH] " Pavel Begunkov (Silence)
2019-10-04  8:32 ` Pavel Begunkov
2019-10-04  9:23 ` kbuild test robot
2019-10-04  9:33 ` kbuild test robot
2019-10-04 10:07 ` [PATCH v2] " Pavel Begunkov (Silence)
2019-10-04 13:05   ` Jens Axboe
2019-10-04 13:58     ` Pavel Begunkov [this message]
2019-10-04 14:01   ` [PATCH v3] " Pavel Begunkov (Silence)
2019-10-04 14:04     ` Jens Axboe

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=d3e3b157-c8e7-0e75-099d-9ceea6659bf8@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®