From: Christian Brauner <brauner@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>, Amir Goldstein <amir73il@gmail.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org,
Christian Brauner <brauner@kernel.org>
Subject: [PATCH RFC 0/3] ovl: specify layers via file descriptors
Date: Fri, 11 Oct 2024 17:43:34 +0200 [thread overview]
Message-ID: <20241011-work-overlayfs-v1-0-e34243841279@kernel.org> (raw)
Hey,
Currently overlayfs only allows specifying layers through path names.
This is inconvenient for users such as systemd that want to assemble an
overlayfs mount purely based on file descriptors.
When porting overlayfs to the new mount api I already provided patches
for this but we decided to keep this work separate. This is a revamp of
the patchset as the use-case has become more urgent.
This introduces the new mount options:
lowerdir_fd+
datadir_fd+
upperdir_fd
workdir_fd
which can be used as follows:
fsconfig(fd_overlay, FSCONFIG_SET_FD, "upperdir_fd+", NULL, fd_upper);
fsconfig(fd_overlay, FSCONFIG_SET_FD, "workdir_fd+", NULL, fd_work);
fsconfig(fd_overlay, FSCONFIG_SET_FD, "lowerdir_fd+", NULL, fd_lower1);
fsconfig(fd_overlay, FSCONFIG_SET_FD, "lowerdir_fd+", NULL, fd_lower2);
The selftest contains an example for this.
The mount api doesn't allow overloading of mount option parameters
(except for strings and flags). Making this work for arbitrary
parameters would be quite ugly or file descriptors would have to be
special cased. Neither is very appealing. I do prefer the *_fd mount
options because they aren't ambiguous.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
Christian Brauner (3):
ovl: specify layers via file descriptors
selftests: use shared header
selftests: add overlayfs fd mounting selftests
fs/overlayfs/params.c | 132 +++++++++++++++++----
.../selftests/filesystems/overlayfs/.gitignore | 1 +
.../selftests/filesystems/overlayfs/Makefile | 2 +-
.../selftests/filesystems/overlayfs/dev_in_maps.c | 27 +----
.../filesystems/overlayfs/set_layers_via_fds.c | 122 +++++++++++++++++++
.../selftests/filesystems/overlayfs/wrappers.h | 47 ++++++++
6 files changed, 281 insertions(+), 50 deletions(-)
---
base-commit: 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b
change-id: 20241011-work-overlayfs-dbcfa9223e87
next reply other threads:[~2024-10-11 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 15:43 Christian Brauner [this message]
2024-10-11 15:43 ` [PATCH RFC 1/3] ovl: specify layers via file descriptors Christian Brauner
2024-10-11 15:43 ` [PATCH RFC 2/3] selftests: use shared header Christian Brauner
2024-10-11 15:43 ` [PATCH RFC 3/3] selftests: add overlayfs fd mounting selftests Christian Brauner
2024-10-11 15:52 ` [PATCH RFC 0/3] ovl: specify layers via file descriptors Miklos Szeredi
2024-10-11 20:57 ` 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=20241011-work-overlayfs-v1-0-e34243841279@kernel.org \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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).