From: Al Viro <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Stefan Roesch <[email protected]>,
[email protected], [email protected]
Subject: Re: [PATCH v2 0/3] io_uring: add getdents64 support
Date: Fri, 31 Dec 2021 23:27:24 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On Wed, Dec 15, 2021 at 02:09:52PM -0700, Jens Axboe wrote:
> On 11/24/21 4:16 PM, Stefan Roesch wrote:
> > This series adds support for getdents64 in liburing. The intent is to
> > provide a more complete I/O interface for io_uring.
> >
> > Patch 1: fs: add parameter use_fpos to iterate_dir()
> > This adds a new parameter to the function iterate_dir() so the
> > caller can specify if the position is the file position or the
> > position stored in the buffer context.
> >
> > Patch 2: fs: split off vfs_getdents function from getdents64 system call
> > This splits of the iterate_dir part of the syscall in its own
> > dedicated function. This allows to call the function directly from
> > liburing.
> >
> > Patch 3: io_uring: add support for getdents64
> > Adds the functions to io_uring to support getdents64.
> >
> > There is also a patch series for the changes to liburing. This includes
> > a new test. The patch series is called "liburing: add getdents support."
>
> Al, ping on this one as well, same question on the VFS side.
First of all, apologies for being MIA - had been sick for a couple of
months, so right now I'm digging through the huge pile of mail.
The problem is not with VFS side - it's with ->iterate_dir() *instances*.
The logics for validation of file position in there is not pretty, and
it's based upon the assumption that all position changes (other than
those from ->iterate_dir() itself) come through lseek(2), with its
per-opened-file exclusion with getdents(2).
Your API just shoves an arbitrary number at them, with no indication
as far as struct file instance is concerned that something might need
to be checked. Hell, the file might've been just opened with no
directory-changing operations done since then; of course its position
is valid. And has nothing whatsoever with the number you put into
ctx->pos.
Normalization is sufficiently costly to show up on real-world loads.
Even "assume it bogus" flag somewhere in ctx will seriously cost on
io_uring side. And that doesn't help with the case of tmpfs et.al.
where position is ignored - there's a per-instance cursor moved
around on lseek/readdir and that's the authoritative thing there.
So please, use a saner userland ABI - pread-like stuff is a really,
really bad idea for directories.
prev parent reply other threads:[~2021-12-31 23:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 23:16 [PATCH v2 0/3] io_uring: add getdents64 support Stefan Roesch
2021-11-24 23:16 ` [PATCH v2 1/3] fs: add parameter use_fpos to iterate_dir function Stefan Roesch
2021-11-24 23:16 ` [PATCH v2 2/3] fs: split off vfs_getdents function of getdents64 syscall Stefan Roesch
2021-11-24 23:17 ` [PATCH v2 3/3] io_uring: add support for getdents64 Stefan Roesch
2021-11-25 4:42 ` [PATCH v2 0/3] io_uring: add getdents64 support Clay Harris
2021-12-01 6:01 ` Stefan Roesch
2021-12-01 7:11 ` Clay Harris
2021-12-15 21:09 ` Jens Axboe
2021-12-31 23:27 ` Al Viro [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] \
[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