From: Jens Axboe <[email protected]>
To: Kirill Tkhai <[email protected]>,
LKML <[email protected]>,
[email protected]
Subject: Re: io_uring: io_grab_files() misses taking files->count?
Date: Thu, 6 Feb 2020 12:55:38 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 2/6/20 9:32 AM, Kirill Tkhai wrote:
> Hi, Jens,
>
> in io_grab_files() we take pointer to current->files without taking
> files->count. Later, this files become attached to worker in
> io_worker_handle_work() also without any manipulation with counter.
>
> But files->count is used for different optimizations. Say, in
> expand_fdtable() we avoid synchonize_rcu() in case of there is only
> files user. In case of there are more users, missing of
> synchronize_rcu() is not safe.
>
> Is this correct? Or maybe there is some hidden logic in io_uring,
> which prevents this problem? Say, IORING_OP_OPENAT/CLOSE/ETC can't be
> propagated to worker etc...
We track requests that grab files on the side, since we can't safely
grab a reference to the file table. We could have our own ring fd in the
file table, and thus create a circular reference if we incremented
files->count here.
Looks like we might need a 2nd way to know if we need to use
synchronize_rcu() or not, though I need to look into this particular
case.
--
Jens Axboe
prev parent reply other threads:[~2020-02-06 19:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 16:32 io_uring: io_grab_files() misses taking files->count? Kirill Tkhai
2020-02-06 19:55 ` Jens Axboe [this message]
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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