public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>,
	Aleksa Sarai <cyphar@cyphar.com>,
	Chuck Lever <chuck.lever@oracle.com>,
	linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH v2 0/2] API for exporting connectable file handles to userspace
Date: Mon, 23 Sep 2024 10:28:27 +0200	[thread overview]
Message-ID: <20240923082829.1910210-1-amir73il@gmail.com> (raw)

Jeff,

These patches bring the NFS connectable file handles feature to
userspace servers.

They rely on Christian's and Aleksa's changes recently merged to v6.12.

I am aware of the usability implications with connectable file handles,
which are not consistent throughout the inode lifetime (i.e. when moved
to another parent), but the nfsd feature does exists and some users (me)
are interested in exporting this feature to userspace.

The API I chose for encoding conenctable file handles is pretty
conventional (AT_HANDLE_CONNECTABLE).

open_by_handle_at(2) does not have AT_ flags argument, but also, I find
it more useful API that encoding a connectable file handle can mandate
the resolving of a connected fd, without having to opt-in for a
connected fd independently.

Therefore, the whacky API from RFC was replaced with an explicit
connectable flag in the unused (*) upper bits of the handle_type.

(*) It may be valid for filesystems to return a handle type with upper
bits set, but AFAIK, no filesystem does that.

I chose to implemnent this by re-farmatting struct file_handle using bit
feilds.  While using bit fields in UAPI is a questionable practice,
file_handle is not actually in the UAPI and the legacy struct
file_handle which is described in the man page, is binary compatible
with the modified kernel definition with bit fields.
If this is a problem, I can add (and strip) the connectable bit using
plain arithmetics.

Thought and flames are welcome.

Thanks,
Amir.

Changes since v1 [1]:
- Assert on encode for disconnected path (Jeff)
- Don't allow AT_HANDLE_CONNECTABLE with AT_EMPTY_PATH
- Drop the O_PATH mount_fd API hack (Jeff)
- Encode an explicit "connectable" flag in handle type

[1] https://lore.kernel.org/linux-fsdevel/20240919140611.1771651-1-amir73il@gmail.com/

Amir Goldstein (2):
  fs: name_to_handle_at() support for "explicit connectable" file
    handles
  fs: open_by_handle_at() support for decoding "explicit connectable"
    file handles

 fs/fhandle.c               | 70 ++++++++++++++++++++++++++++++++++----
 include/linux/exportfs.h   |  2 ++
 include/linux/fs.h         |  3 +-
 include/uapi/linux/fcntl.h |  1 +
 4 files changed, 69 insertions(+), 7 deletions(-)

-- 
2.34.1


             reply	other threads:[~2024-09-23  8:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23  8:28 Amir Goldstein [this message]
2024-09-23  8:28 ` [PATCH v2 1/2] fs: name_to_handle_at() support for "explicit connectable" file handles Amir Goldstein
2024-09-23  8:28 ` [PATCH v2 2/2] fs: open_by_handle_at() support for decoding " Amir Goldstein
2024-09-25  9:13 ` [PATCH v2 0/2] API for exporting connectable file handles to userspace Christian Brauner
2024-10-07 15:26   ` Amir Goldstein
2024-10-07 18:09     ` Chuck Lever III
2024-10-08 10:43       ` Amir Goldstein
2024-10-08 11:07     ` Jeff Layton
2024-10-08 13:11       ` Amir Goldstein
2024-10-08 13:43         ` Jeff Layton
2024-10-08 14:50           ` Amir Goldstein
2024-10-09  9:40         ` Jan Kara
2024-10-09 15:16           ` Amir Goldstein
2024-10-09 15:47             ` Amir Goldstein

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=20240923082829.1910210-1-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=cyphar@cyphar.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@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