public inbox for linux-api@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jan Kara <jack@suse.cz>, Aleksa Sarai <cyphar@cyphar.com>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Chuck Lever <chuck.lever@oracle.com>,
	 Jeff Layton <jlayton@kernel.org>,
	Amir Goldstein <amir73il@gmail.com>,
	 Alexander Aring <alex.aring@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [PATCH RFC v2] fhandle: expose u64 mount id to name_to_handle_at(2)
Date: Wed, 29 May 2024 09:40:01 +0200	[thread overview]
Message-ID: <20240529-marzipan-verspannungen-48b760c2f66b@brauner> (raw)
In-Reply-To: <ZlXaj9Qv0bm9PAjX@infradead.org>

On Tue, May 28, 2024 at 06:22:23AM -0700, Christoph Hellwig wrote:
> On Tue, May 28, 2024 at 02:04:16PM +0200, Christian Brauner wrote:
> > Can you please explain how opening an fd based on a handle returned from
> > name_to_handle_at() and not using a mount file descriptor for
> > open_by_handle_at() would work?
> 
> Same as NFS file handles:
> 
> name_to_handle_at returns a handle that includes a file system
> identifier.
> 
> open_by_handle_at looks up the superblock based on that identifier.
> 
> For the identifier I could imagin three choices:
> 
>  1) use the fsid as returned in statfs and returned by fsnotify.
>     The downside is that it is "only" 64-bit.  The upside is that
>     we have a lot of plumbing for it
>  2) fixed 128-bit identifier to provide more entropy
>  3) a variable length identifier, which is more similar to NFS,
>     but also a lot more complicated
> 
> We'd need a global lookup structure to find the sb by id.  The simplest
> one would be a simple linear loop over super_blocks which isn't terribly
> efficient, but probably better than whatever userspace is doing to
> find a mount fd right now.
> 
> Let me cook up a simple prototype for 1) as it shouldn't be more than
> a few hundred lines of code.

Yeah, that's exactly what I figured and no that's not something we
should do.

Not just can have a really large number of superblocks if you have mount
namespaces and large container workloads that interface also needs to be
highly privileged.

Plus, you do have filesystems like btrfs that can be mounted multiple
times with the same uuid.

And in general users will still need to be able to legitimately use a
mount fd and not care about the handle type used with it.

  parent reply	other threads:[~2024-05-29  7:40 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 20:57 [PATCH RFC v2] fhandle: expose u64 mount id to name_to_handle_at(2) Aleksa Sarai
2024-05-24  4:58 ` Amir Goldstein
2024-05-26  9:25 ` Christoph Hellwig
2024-05-26 19:01   ` Aleksa Sarai
2024-05-27 11:47     ` Christoph Hellwig
2024-05-27 12:29       ` Christian Brauner
2024-05-27 13:17         ` Christian Brauner
2024-05-27 15:47           ` Trond Myklebust
2024-05-28  7:05             ` Christian Brauner
2024-05-27 16:18         ` Christoph Hellwig
2024-05-27 13:34       ` Jan Kara
2024-05-27 16:24         ` Christoph Hellwig
2024-05-28  8:20           ` Christian Brauner
2024-05-28  8:28             ` Christoph Hellwig
2024-05-28  9:17               ` Christian Brauner
2024-05-28 10:55                 ` Christoph Hellwig
2024-05-28 12:04                   ` Christian Brauner
2024-05-28 13:22                     ` Christoph Hellwig
2024-05-28 13:28                       ` Miklos Szeredi
2024-05-29  6:34                         ` Christoph Hellwig
2024-06-01  8:12                         ` Aleksa Sarai
2024-06-03 10:30                           ` Jan Kara
2024-06-04  5:22                           ` Christoph Hellwig
2024-05-29  7:40                       ` Christian Brauner [this message]
2024-05-31  8:14                         ` Christoph Hellwig
2024-05-31 10:28                           ` Christian Brauner
2024-05-26 22:32   ` Trond Myklebust
2024-05-27 11:49     ` hch
2024-05-27 15:38       ` Trond Myklebust
2024-05-27 16:29         ` hch
2024-05-28  7:12           ` Christian Brauner
2024-05-28  7:15             ` hch
2024-05-28 10:11           ` Jan Kara
2024-05-28 10:56             ` hch
2024-05-28 23:25               ` Dave Chinner
2024-05-29  6:24                 ` hch
2024-05-29  7:23                   ` Amir Goldstein
2024-05-27 12:22   ` Christian Brauner

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=20240529-marzipan-verspannungen-48b760c2f66b@brauner \
    --to=brauner@kernel.org \
    --cc=alex.aring@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=chuck.lever@oracle.com \
    --cc=cyphar@cyphar.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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