diff options
author | felixdoerre <[email protected]> | 2020-05-21 04:02:41 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-20 18:02:41 -0700 |
commit | 501a1511aeaaf8f7b50410ef7e64e06647aa8dfb (patch) | |
tree | 605dbad078ed66f976f1799831093bc08a67cd9c /include | |
parent | 57434abae6af23cf0b0b360882762dfae7fee555 (diff) |
mount: use the mount syscall directly
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 <[email protected]>
Signed-off-by: Felix Dörre <[email protected]>
#10294
Diffstat (limited to 'include')
-rw-r--r-- | include/libzfs.h | 7 | ||||
-rw-r--r-- | include/libzfs_impl.h | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/include/libzfs.h b/include/libzfs.h index 551b6ae74..d9f0d7259 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -803,6 +803,13 @@ extern int zfs_mount_at(zfs_handle_t *, const char *, int, const char *); extern int zfs_unmount(zfs_handle_t *, const char *, int); extern int zfs_unmountall(zfs_handle_t *, int); +#if defined(__linux__) +extern int zfs_parse_mount_options(char *mntopts, unsigned long *mntflags, + unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt); +extern void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint, + char *mntopts, char *mtabopt); +#endif + /* * Share support functions. */ diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h index be11b1fc0..91fa1efbb 100644 --- a/include/libzfs_impl.h +++ b/include/libzfs_impl.h @@ -246,7 +246,8 @@ typedef struct differ_info { extern proto_table_t proto_table[PROTO_END]; -extern int do_mount(const char *src, const char *mntpt, char *opts, int flags); +extern int do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, + int flags); extern int do_unmount(const char *mntpt, int flags); extern int zfs_mount_delegation_check(void); extern int zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto); |