aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2024-11-25 11:29:29 +0100
committerKarel Zak <kzak@redhat.com>2024-11-25 11:29:29 +0100
commit9c002985512ddbae8a95cf488c5a1cc780564b49 (patch)
treee431415358cc534518defbcf407666758e95f50b
parent9902cf42b8c5140aae163598c3228f2a63a417de (diff)
parent5e9711473fc871155017c7747364b9e4ae2ecfb9 (diff)
downloadutil-linux-9c002985512ddbae8a95cf488c5a1cc780564b49.tar.gz
Merge branch 'PR/libmount-noloopdev' of https://github.com/karelzak/util-linux-work
* 'PR/libmount-noloopdev' of https://github.com/karelzak/util-linux-work: libmount: support X-mount.noloop
-rw-r--r--libmount/src/hook_loopdev.c3
-rw-r--r--sys-utils/mount.8.adoc5
2 files changed, 7 insertions, 1 deletions
diff --git a/libmount/src/hook_loopdev.c b/libmount/src/hook_loopdev.c
index c01d536ce1..a19ddab3be 100644
--- a/libmount/src/hook_loopdev.c
+++ b/libmount/src/hook_loopdev.c
@@ -423,6 +423,9 @@ static int is_loopdev_required(struct libmnt_context *cxt, struct libmnt_optlist
|| mnt_context_propagation_only(cxt))
return 0;
+ if (mnt_optlist_get_named(ol, "X-mount.noloop", cxt->map_userspace))
+ return 0;
+
src = mnt_fs_get_srcpath(cxt->fs);
if (!src)
return 0; /* backing file not set */
diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc
index f25c1c488a..3a458c52e4 100644
--- a/sys-utils/mount.8.adoc
+++ b/sys-utils/mount.8.adoc
@@ -760,7 +760,10 @@ The command line option *--no-canonicalize* overrides this mount option and affe
+
Note that *mount*(8) still sanitizes and canonicalizes the source and target paths specified on the command line by non-root users, regardless of the X-mount.nocanonicalize setting.
-**X-mount.subdir=**__directory__::
+*X-mount.noloop*::
+Do not create and mount a loop device, even if the source of the mount is a regular file.
+
+*X-mount.subdir=*__directory__::
Allow mounting sub-directory from a filesystem instead of the root directory. For now, this feature is implemented by temporary filesystem root directory mount in unshared namespace and then bind the sub-directory to the final mount point and umount the root of the filesystem. The sub-directory mount shows up atomically for the rest of the system although it is implemented by multiple *mount*(2) syscalls.
+
Note that this feature will not work in session with an unshared private mount namespace (after *unshare --mount*) on old kernels or with *mount*(8) without support for file-descriptors-based mount kernel API. In this case, you need *unshare --mount --propagation shared*.