linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Dave Chinner <david@fromorbit.com>,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	Jan Kara <jack@suse.cz>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>
Subject: Re: [PATCH] xfs: use a unique and persistent value for f_fsid
Date: Sat, 27 Mar 2021 12:06:41 +0300	[thread overview]
Message-ID: <CAOQ4uxgQNfESKGM3E_aFYtkj6SpP93h8Z3T5Q9yyDGNpGzTayg@mail.gmail.com> (raw)
In-Reply-To: <20210326191554.GB13139@fieldses.org>

On Fri, Mar 26, 2021 at 10:15 PM J. Bruce Fields <bfields@fieldses.org> wrote:
>
> On Tue, Mar 23, 2021 at 06:50:44AM +0200, Amir Goldstein wrote:
> > On Tue, Mar 23, 2021 at 1:03 AM Dave Chinner <david@fromorbit.com> wrote:
> > > should be using something common across all filesystems from the
> > > linux superblock, not deep dark internal filesystem magic. The
> > > export interfaces that generate VFS (and NFS) filehandles already
> > > have a persistent fsid associated with them, which may in fact be
> > > the filesystem UUID in it's entirety.
> > >
> >
> > Yes, nfsd is using dark internal and AFAIK undocumnetd magic to
> > pick that identifier (Bruce, am I wrong?).
>
> Sorry, I kept putting off catching up with this thread and only now
> noticed the question.
>
> It's actually done mostly in userspace (rpc.mountd), so "dark internal"
> might not be fair, but it is rather complicated.  There are several
> options (UUID, device number, number provided by the user with fsid=
> option), and I don't recall the logic behind which we use when.
>

I'll take back "dark internal" then and replace it with "light external" ;-)
which is also a problem. If userspace is involved in declaring the id
of the *export* then from NFS client POV, that is not a problem, but
from fsnotify POV, that identifier cannot be determined when an event
happens on an inode NOT via the NFS client.

As a matter of fact, the fanotify requirements about fsid are even more
strict than being able to get fsid from the inode. From fanotify_mark.2:
"
       EXDEV  The filesystem object indicated by pathname resides within
              a filesystem subvolume (e.g., btrfs(5)) which uses a
different fsid
              than its root superblock...
"

> I don't *think* we have good comprehensive documentation of it anywhere.
> I wish we did.  It'd take a little time to put together.  Starting
> points would be linux/fs/nfsd/nfsfh.c and
> nfs-utils/support/export/cache.c.

At least as far as fanotify is concerned, the documentation is not going
to matter. The only thing needed is an fsid value that is queryable via
a userspace API.

f_fsid meets this criteria, which is why it was chosen for fanotify.
Having the fsid reported by fanotify also be stable is a nice to have
feature for very selective use cases, which is why I posted this xfs patch.

Thanks,
Amir.

      reply	other threads:[~2021-03-27  9:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 17:11 [PATCH] xfs: use a unique and persistent value for f_fsid Amir Goldstein
2021-03-22 23:03 ` Dave Chinner
2021-03-23  4:50   ` Amir Goldstein
2021-03-23  6:35     ` Darrick J. Wong
2021-03-23  6:44       ` Amir Goldstein
2021-03-23  7:26     ` Dave Chinner
2021-03-23  9:35       ` Amir Goldstein
2021-03-24  0:54         ` Dave Chinner
2021-03-24  6:53           ` Amir Goldstein
2021-03-24  7:43             ` Christoph Hellwig
2021-03-24  9:18               ` Amir Goldstein
2021-03-25 23:03                 ` Dave Chinner
2021-03-25 22:53             ` Dave Chinner
2021-03-26  6:04               ` Amir Goldstein
2021-03-26 22:34                 ` Theodore Ts'o
2021-03-27  9:14                   ` Amir Goldstein
2021-03-26 19:15     ` J. Bruce Fields
2021-03-27  9:06       ` Amir Goldstein [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 \
    --in-reply-to=CAOQ4uxgQNfESKGM3E_aFYtkj6SpP93h8Z3T5Q9yyDGNpGzTayg@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=christian.brauner@ubuntu.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@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 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).