All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, linux-block@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, jannh@google.com
Subject: Re: [PATCH 2/4] io_uring: io_uring: add support for async work inheriting files
Date: Fri, 25 Oct 2019 15:45:33 -0600	[thread overview]
Message-ID: <0ea19a52-a1cf-ae8a-82d7-f4ffb3c0286b@kernel.dk> (raw)
In-Reply-To: <c33f7137-5b54-c588-f4e8-dd7e1e03edf3@gmail.com>

On 10/25/19 3:31 PM, Pavel Begunkov wrote:
> On 25/10/2019 20:30, Jens Axboe wrote:
>> +static int io_grab_files(struct io_ring_ctx *ctx, struct io_kiocb *req)
>> +{
>> +	int ret = -EBADF;
>> +
>> +	rcu_read_lock();
>> +	spin_lock_irq(&ctx->inflight_lock);
>> +	/*
>> +	 * We use the f_ops->flush() handler to ensure that we can flush
>> +	 * out work accessing these files if the fd is closed. Check if
>> +	 * the fd has changed since we started down this path, and disallow
>> +	 * this operation if it has.
>> +	 */
>> +	if (fcheck(req->submit.ring_fd) == req->submit.ring_file) {
> Can we get here from io_submit_sqes()?
> ring_fd will be uninitialised in this case.

We can't, we disallow submission of any opcode (for now just accept)
from the sq thread that needs a file table.

-- 
Jens Axboe


  reply	other threads:[~2019-10-25 21:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 17:30 [PATCHSET v2 0/4] io_uring: add support for accept(4) Jens Axboe
2019-10-25 17:30 ` [PATCH 1/4] io_uring: reorder struct sqe_submit Jens Axboe
2019-10-25 17:30 ` [PATCH 2/4] io_uring: io_uring: add support for async work inheriting files Jens Axboe
2019-10-25 21:31   ` Pavel Begunkov
2019-10-25 21:45     ` Jens Axboe [this message]
2020-01-26 10:12   ` Andres Freund
2020-01-26 17:10     ` Jens Axboe
2020-01-26 17:17       ` Jens Axboe
2020-01-26 20:07         ` Andres Freund
2019-10-25 17:30 ` [PATCH 3/4] net: add __sys_accept4_file() helper Jens Axboe
2019-10-25 17:30 ` [PATCH 4/4] io_uring: add support for IORING_OP_ACCEPT 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=0ea19a52-a1cf-ae8a-82d7-f4ffb3c0286b@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jannh@google.com \
    --cc=linux-block@vger.kernel.org \
    --cc=netdev@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.