From: Dave Chinner <david@fromorbit.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: NeilBrown <neilb@suse.de>, Donald Buczek <buczek@molgen.mpg.de>,
linux-bcachefs@vger.kernel.org,
Stefan Krueger <stefan.krueger@aei.mpg.de>,
David Howells <dhowells@redhat.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: file handle in statx (was: Re: How to cope with subvolumes and snapshots on muti-user systems?)
Date: Wed, 13 Dec 2023 07:48:16 +1100 [thread overview]
Message-ID: <ZXjHEPn3DfgQNoms@dread.disaster.area> (raw)
In-Reply-To: <20231212152153.tasaxsrljq2zzbxe@moria.home.lan>
On Tue, Dec 12, 2023 at 10:21:53AM -0500, Kent Overstreet wrote:
> On Tue, Dec 12, 2023 at 04:53:28PM +1100, Dave Chinner wrote:
> > Doesn't anyone else see or hear the elephant trumpeting loudly in
> > the middle of the room?
> >
> > I mean, we already have name_to_handle_at() for userspace to get a
> > unique, opaque, filesystem defined file handle for any given file.
> > It's the same filehandle that filesystems hand to the nfsd so nfs
> > clients can uniquely identify the file they are asking the nfsd to
> > operate on.
> >
> > The contents of these filehandles is entirely defined by the file
> > system and completely opaque to the user. The only thing that
> > parses the internal contents of the handle is the filesystem itself.
> > Therefore, as long as the fs encodes the information it needs into the
> > handle to determine what subvol/snapshot the inode belongs to when
> > the handle is passed back to it (e.g. from open_by_handle_at()) then
> > nothing else needs to care how it is encoded.
> >
> > So can someone please explain to me why we need to try to re-invent
> > a generic filehandle concept in statx when we already have a
> > have working and widely supported user API that provides exactly
> > this functionality?
>
> Definitely should be part of the discussion :)
>
> But I think it _does_ need to be in statx; because:
> - we've determined that 64 bit ino_t just isn't a future proof
> interface, we're having real problems with it today
> - statx is _the_ standard, future proofed interface for getting inode
> attributes
No, it most definitely isn't, and statx was never intended as a
dumping ground for anything and everything inode related. e.g. Any
inode attribute that can be modified needs to use a different
interface - one that has a corresponding "set" operation.
> - therefore, if we want userspace programmers to be using filehandles,
> instead of inode numbers, so there code isn't broken, we need to be
> providing interfaces that guide them in that direction.
We already have a filehandle interface they can use for this
purpose. It is already used by some userspace applications for this
purpose.
Anything new API function do with statx() will require application
changes, and the vast majority of applications aren't using statx()
directly - they are using stat() which glibc wraps to statx()
internally. So they are going to need a change of API, anyway.
So, fundamentally, there is a change of API for most applications
that need to do thorough inode uniqueness checks regardless of
anything else. They can do this right now - just continue using
stat() as they do right now, and then use name_to_filehandle_at()
for uniqueness checks.
> Even assuming we can update all the documentation to say "filehandles
> are the correct way to test inode uniqueness", you know at least half of
> programmers will stick to stx_ino instead of the filehandle if the
> filehandle is an extra syscall.
Your argument is "programmers suck so we must design for the
lowest common denominator". That's an -awful- way to design APIs.
Further, this "programmers suck" design comes at a cost to every
statx() call that does not need filehandles. That's the vast
majority of statx() calls that are made on a system. Why should we
slow down statx() for all users when so few applications actually
need uniqueness and they can take the cost of robust uniqueness
tests with an extra syscall entirely themselves?
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2023-12-12 20:48 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 7:49 How to cope with subvolumes and snapshots on muti-user systems? Donald Buczek
2023-11-29 21:43 ` Kent Overstreet
2023-11-30 7:35 ` Donald Buczek
2023-11-30 7:39 ` Kent Overstreet
2023-11-30 20:37 ` NeilBrown
2023-12-04 10:47 ` Donald Buczek
2023-12-04 22:45 ` NeilBrown
2023-12-05 21:35 ` Donald Buczek
2023-12-05 22:01 ` NeilBrown
2023-12-07 11:53 ` Donald Buczek
2023-12-08 1:16 ` NeilBrown
2023-12-08 1:37 ` Kent Overstreet
2023-12-08 2:13 ` NeilBrown
2023-12-08 2:49 ` Kent Overstreet
2023-12-08 11:34 ` Donald Buczek
2023-12-08 20:02 ` Kent Overstreet
2023-12-11 22:43 ` NeilBrown
2023-12-11 23:32 ` file handle in statx (was: Re: How to cope with subvolumes and snapshots on muti-user systems?) Kent Overstreet
2023-12-11 23:40 ` David Howells
2023-12-12 20:59 ` Kent Overstreet
2023-12-12 22:57 ` NeilBrown
2023-12-12 23:43 ` Kent Overstreet
2023-12-13 0:02 ` NeilBrown
2023-12-13 0:14 ` Kent Overstreet
2023-12-13 22:45 ` Andreas Dilger
2023-12-13 23:24 ` Kent Overstreet
2023-12-11 23:53 ` NeilBrown
2023-12-12 0:05 ` Kent Overstreet
2023-12-12 0:59 ` NeilBrown
2023-12-12 1:10 ` Kent Overstreet
2023-12-12 2:13 ` NeilBrown
2023-12-12 2:24 ` Kent Overstreet
2023-12-12 9:08 ` Christian Brauner
2023-12-12 5:53 ` Dave Chinner
2023-12-12 6:32 ` Amir Goldstein
2023-12-12 8:56 ` Christian Brauner
2023-12-12 9:10 ` David Howells
2023-12-12 9:23 ` Christian Brauner
2023-12-12 9:28 ` Miklos Szeredi
2023-12-12 9:35 ` Christian Brauner
2023-12-12 9:42 ` Miklos Szeredi
2023-12-12 13:47 ` Christian Brauner
2023-12-12 14:06 ` Miklos Szeredi
2023-12-12 15:24 ` Christian Brauner
2023-12-12 15:28 ` Kent Overstreet
2023-12-12 9:46 ` David Howells
2023-12-12 15:16 ` Kent Overstreet
2023-12-12 15:29 ` Christian Brauner
2023-12-12 15:35 ` Kent Overstreet
2023-12-12 15:38 ` Miklos Szeredi
2023-12-12 15:43 ` Kent Overstreet
2023-12-12 15:57 ` Miklos Szeredi
2023-12-12 16:08 ` Kent Overstreet
2023-12-12 16:30 ` Miklos Szeredi
2023-12-12 16:41 ` Kent Overstreet
2023-12-12 21:53 ` NeilBrown
2023-12-13 9:41 ` Christian Brauner
2023-12-12 21:46 ` NeilBrown
2023-12-13 9:47 ` Christian Brauner
2023-12-13 10:04 ` Christian Brauner
2023-12-14 22:47 ` NeilBrown
2023-12-15 0:36 ` Kent Overstreet
2023-12-12 7:03 ` David Howells
2023-12-12 9:10 ` file handle in statx Donald Buczek
2023-12-12 15:20 ` Theodore Ts'o
2023-12-12 17:15 ` Frank Filz
2023-12-12 17:44 ` Kent Overstreet
2023-12-12 18:17 ` Amir Goldstein
2023-12-12 19:18 ` Frank Filz
2023-12-12 20:59 ` Dave Chinner
2023-12-12 21:57 ` NeilBrown
2023-12-12 22:23 ` Dave Chinner
2023-12-12 22:36 ` NeilBrown
2023-12-12 22:39 ` Kent Overstreet
2023-12-12 23:44 ` Dave Chinner
2023-12-13 0:00 ` Kent Overstreet
2023-12-13 7:37 ` Donald Buczek
2023-12-13 12:28 ` Kent Overstreet
2023-12-13 13:48 ` Donald Buczek
2023-12-19 7:41 ` Donald Buczek
2023-12-12 15:21 ` file handle in statx (was: Re: How to cope with subvolumes and snapshots on muti-user systems?) Kent Overstreet
2023-12-12 20:48 ` Dave Chinner [this message]
2023-12-12 21:23 ` Kent Overstreet
2023-12-12 22:10 ` Dave Chinner
2023-12-12 22:31 ` NeilBrown
2023-12-12 23:06 ` Dave Chinner
2023-12-12 23:42 ` Kent Overstreet
2023-12-13 0:03 ` NeilBrown
2023-12-12 22:00 ` NeilBrown
2023-12-12 0:25 ` David Howells
2023-12-13 12:43 ` How to cope with subvolumes and snapshots on muti-user systems? Donald Buczek
2023-11-30 20:36 ` NeilBrown
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=ZXjHEPn3DfgQNoms@dread.disaster.area \
--to=david@fromorbit.com \
--cc=buczek@molgen.mpg.de \
--cc=dhowells@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=stefan.krueger@aei.mpg.de \
/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