From 501a1511aeaaf8f7b50410ef7e64e06647aa8dfb Mon Sep 17 00:00:00 2001 From: felixdoerre Date: Thu, 21 May 2020 04:02:41 +0300 Subject: mount: use the mount syscall directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow zfs datasets to be mounted on Linux without relying on the invocation of an external processes. This is the same behavior which is implemented for FreeBSD. Use of the libmount library was originally considered because it provides functionality to properly lock and update the /etc/mtab file. However, these days /etc/mtab is typically a symlink to /proc/self/mounts so there's nothing to updated. Therefore, we call mount(2) directly and avoid any additional dependencies. If required the legacy behavior can be enabled by setting the ZFS_MOUNT_HELPER environment variable. This may be needed in environments where SELinux in enabled and the zfs binary does not have mount permission. Reviewed-by: Brian Behlendorf Signed-off-by: Felix Dörre #10294 --- lib/libzfs/libzfs_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libzfs/libzfs_mount.c') diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 4d4b49753..4123968b0 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -500,7 +500,7 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags, } /* perform the mount */ - rc = do_mount(zfs_get_name(zhp), mountpoint, mntopts, flags); + rc = do_mount(zhp, mountpoint, mntopts, flags); if (rc) { /* * Generic errors are nasty, but there are just way too many -- cgit v1.2.3