io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Hao Xu <haoxu@linux.alibaba.com>
Cc: io-uring@vger.kernel.org, Pavel Begunkov <asml.silence@gmail.com>,
	Joseph Qi <joseph.qi@linux.alibaba.com>
Subject: Re: [PATCH] io_uring: check file_slot early when accept use fix_file mode
Date: Tue, 7 Sep 2021 09:37:06 -0600	[thread overview]
Message-ID: <bce206fe-46d9-7c84-c18c-68ef6210aa35@kernel.dk> (raw)
In-Reply-To: <1cff2f6f-d979-f667-180f-b09d548aa640@linux.alibaba.com>

On 9/7/21 9:32 AM, Hao Xu wrote:
> 在 2021/9/7 下午11:24, Jens Axboe 写道:
>> On 9/7/21 9:16 AM, Hao Xu wrote:
>>> check file_slot early in io_accept_prep() to avoid wasted effort in
>>> failure cases.
>>
>> It's generally better to just let the failure cases deal with it instead
>> of having checks in multiple places. This is a failure path, so we don't
>> care about making it fail early. Optimizations should be for the hot path,
>> which is not a malformed sqe.
> I have a question here: if we do do_accept() and but fail in
> io_install_fixed_file(), do we lose the conn_fd return by do_accept()
> forever?

We do. The file is put and everything, so we're not leaking anything.
But the actual connection is lost as the accept request failed.

-- 
Jens Axboe


  reply	other threads:[~2021-09-07 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 15:16 [PATCH] io_uring: check file_slot early when accept use fix_file mode Hao Xu
2021-09-07 15:24 ` Jens Axboe
2021-09-07 15:32   ` Hao Xu
2021-09-07 15:37     ` Jens Axboe [this message]
2021-09-07 15:42       ` Hao Xu
2021-09-07 15:44         ` 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=bce206fe-46d9-7c84-c18c-68ef6210aa35@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=haoxu@linux.alibaba.com \
    --cc=io-uring@vger.kernel.org \
    --cc=joseph.qi@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).