linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Dave Chinner <david@fromorbit.com>, NeilBrown <neilb@suse.de>,
	Kent Overstreet <kent.overstreet@linux.dev>,
	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, Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: file handle in statx (was: Re: How to cope with subvolumes and snapshots on muti-user systems?)
Date: Tue, 12 Dec 2023 09:56:45 +0100	[thread overview]
Message-ID: <20231212-impfung-linden-6f973f2ade19@brauner> (raw)
In-Reply-To: <CAOQ4uxiQcOk1Kw1JX4602vjuWNfL=b_A3uB1FJFaHQbEX6OOMA@mail.gmail.com>

On Tue, Dec 12, 2023 at 08:32:55AM +0200, Amir Goldstein wrote:
> On Tue, Dec 12, 2023 at 7:53 AM Dave Chinner <david@fromorbit.com> wrote:
> >
> > On Tue, Dec 12, 2023 at 11:59:51AM +1100, NeilBrown wrote:
> > > On Tue, 12 Dec 2023, Kent Overstreet wrote:
> > > > On Tue, Dec 12, 2023 at 10:53:07AM +1100, NeilBrown wrote:
> > > > > On Tue, 12 Dec 2023, Kent Overstreet wrote:
> > > > > > On Tue, Dec 12, 2023 at 09:43:27AM +1100, NeilBrown wrote:
> > > > > > > On Sat, 09 Dec 2023, Kent Overstreet wrote:
> > > > > > Thoughts?
> > > > > >
> > > > >
> > > > > I'm completely in favour of exporting the (full) filehandle through
> > > > > statx. (If the application asked for the filehandle, it will expect a
> > > > > larger structure to be returned.  We don't need to use the currently
> > > > > reserved space).
> > > > >
> > > > > I'm completely in favour of updating user-space tools to use the
> > > > > filehandle to check if two handles are for the same file.
> > > > >
> > > > > I'm not in favour of any filesystem depending on this for correct
> > > > > functionality today.  As long as the filesystem isn't so large that
> > > > > inum+volnum simply cannot fit in 64 bits, we should make a reasonable
> > > > > effort to present them both in 64 bits.  Depending on the filehandle is a
> > > > > good plan for long term growth, not for basic functionality today.
> > > >
> > > > My standing policy in these situations is that I'll do the stopgap/hacky
> > > > measure... but not before doing actual, real work on the longterm
> > > > solution :)
> > >
> > > Eminently sensible.
> > >
> > > >
> > > > So if we're all in favor of statx as the real long term solution, how
> > > > about we see how far we get with that?
> > > >
> > >
> > > I suggest:
> > >
> > >  STATX_ATTR_INUM_NOT_UNIQUE - it is possible that two files have the
> > >                               same inode number

This is just ugly with questionable value. A constant reminder of how
broken this is. Exposing the subvolume id also makes this somewhat redundant.

> > >
> > >
> > >  __u64 stx_vol     Volume identifier.  Two files with same stx_vol and
> > >                    stx_ino MUST be the same.  Exact meaning of volumes
> > >                    is filesys-specific

Exposing this makes sense. I've mentioned that I'd be open to exporting
the subvolume id in statx before even though I know some people don't
like that. I still stand by that. Especially now that we have btrfs and
bcachefs that both have the concept of a subvolume id it makes sense to
put it into statx().

> > >
> > >  STATX_VOL         Want stx_vol
> > >
> > >   __u8 stx_handle_len  Length of stx_handle if present
> > >   __u8 stx_handle[128] Unique stable identifier for this file.  Will
> > >                        NEVER be reused for a different file.
> > >                        This appears AFTER __statx_pad2, beyond
> > >                        the current 'struct statx'.
> > >  STATX_HANDLE      Want stx_handle_len and stx_handle. Buffer for
> > >                    receiving statx info has at least
> > >                    sizeof(struct statx)+128 bytes.

No, we're should not be reinventing another opaque handle. And even if
it really doesn't belong into statx().

> >
> > Hmmm.
> >
> > 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.

I agree.

> > 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?
> 
> Yeh.
> 
> Not to mention that since commit 64343119d7b8 ("exportfs: support encoding
> non-decodeable file handles by default"), exporting file handles as strong
> object identifiers is not limited to filesystems that support NFS export.
> 
> All fs have a default implementation of encode_fh() by encoding a file id
> of type FILEID_INO64_GEN from { i_ino, i_generation } and any fs can
> define its own encode_fh() operation (e.g. to include subvol id) even without
> implementing the decode fh operations needed for NFS export.

I also would like both btrfs and bcachefs to agree.

  reply	other threads:[~2023-12-12  8:56 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12f711f9-70a2-408e-8588-2839e599b668@molgen.mpg.de>
     [not found] ` <170181366042.7109.5045075782421670339@noble.neil.brown.name>
     [not found]   ` <97375d00-4bf7-4c4f-96ec-47f4078abb3d@molgen.mpg.de>
     [not found]     ` <170199821328.12910.289120389882559143@noble.neil.brown.name>
     [not found]       ` <20231208013739.frhvlisxut6hexnd@moria.home.lan>
     [not found]         ` <170200162890.12910.9667703050904306180@noble.neil.brown.name>
     [not found]           ` <20231208024919.yjmyasgc76gxjnda@moria.home.lan>
     [not found]             ` <630fcb48-1e1e-43df-8b27-a396a06c9f37@molgen.mpg.de>
     [not found]               ` <20231208200247.we3zrwmnkwy5ibbz@moria.home.lan>
     [not found]                 ` <170233460764.12910.276163802059260666@noble.neil.brown.name>
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: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 [this message]
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  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  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
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  7:03                           ` David Howells
2023-12-12  0:25                     ` David Howells
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

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=20231212-impfung-linden-6f973f2ade19@brauner \
    --to=brauner@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=buczek@molgen.mpg.de \
    --cc=david@fromorbit.com \
    --cc=dhowells@redhat.com \
    --cc=josef@toxicpanda.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).