mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Fix mount helper
Several issues related to strange mount/umount behavior were reported and this commit should address most of them. The original idea was to put in place a zfs mount helper (mount.zfs). This helper is used to enforce 'legacy' mount behavior, and perform any extra mount argument processing (selinux, zfsutil, etc). This helper wasn't ready for the 0.6.0-rc1 release but with this change it's functional but needs to extensively tested. This change addresses the following open issues. Closes #101 Closes #107 Closes #113 Closes #115 Closes #119
This commit is contained in:
@@ -31,9 +31,6 @@
|
||||
|
||||
#define MNTTYPE_ZFS "zfs" /* ZFS file system */
|
||||
|
||||
#define FSTAB "/etc/fstab"
|
||||
#define MNTMAXSTR 128
|
||||
|
||||
#define MOUNT_SUCCESS 0x00 /* Success */
|
||||
#define MOUNT_USAGE 0x01 /* Invalid invocation or permissions */
|
||||
#define MOUNT_SYSERR 0x02 /* System error (ENOMEM, etc) */
|
||||
@@ -49,6 +46,7 @@
|
||||
#define MNTOPT_AUTO "auto" /* automount */
|
||||
#define MNTOPT_NOAUTO "noauto" /* do not automount */
|
||||
#define MNTOPT_CONTEXT "context" /* selinux context */
|
||||
#define MNTOPT_NOCONTEXT "nocontext" /* No selinux context (zfs-only) */
|
||||
#define MNTOPT_FSCONTEXT "fscontext" /* selinux fscontext */
|
||||
#define MNTOPT_DEFCONTEXT "defcontext" /* selinux defcontext */
|
||||
#define MNTOPT_ROOTCONTEXT "rootcontext" /* selinux rootcontext */
|
||||
@@ -93,10 +91,10 @@
|
||||
#define MNTOPT_XATTR "user_xattr" /* enable extended attributes */
|
||||
#define MNTOPT_NOXATTR "nouser_xattr" /* disable extended attributes */
|
||||
#define MNTOPT_COMMENT "comment" /* comment */
|
||||
#define MNTOPT_BOOTWAIT "bootwait"
|
||||
#define MNTOPT_NOBOOTWAIT "nobootwait"
|
||||
#define MNTOPT_OPTIONAL "optional"
|
||||
#define MNTOPT_SHOWTHROUGH "showthrough"
|
||||
#define MNTOPT_ZFSUTIL "zfsutil" /* called by zfs utility */
|
||||
|
||||
#define ZS_COMMENT 0x00000000 /* comment */
|
||||
#define ZS_ZFSUTIL 0x00000001 /* caller is zfs(8) */
|
||||
#define ZS_NOCONTEXT 0x00000002 /* do not add selinux context */
|
||||
|
||||
#endif /* _SYS_MNTENT_H */
|
||||
|
||||
@@ -72,9 +72,6 @@
|
||||
#include <sys/mntent.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_LIBSELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#endif /* HAVE_LIBSELINUX */
|
||||
|
||||
#include <libzfs.h>
|
||||
|
||||
@@ -346,12 +343,6 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
|
||||
*/
|
||||
strlcat(mntopts, "," MNTOPT_ZFSUTIL, sizeof (mntopts));
|
||||
|
||||
#ifdef HAVE_LIBSELINUX
|
||||
if (is_selinux_enabled())
|
||||
(void) strlcat(mntopts, ",context=\"system_u:"
|
||||
"object_r:file_t:s0\"", sizeof (mntopts));
|
||||
#endif /* HAVE_LIBSELINUX */
|
||||
|
||||
if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
|
||||
return (0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user