Change /etc/mtab to /proc/self/mounts

Fix misleading error message:

 "The /dev/zfs device is missing and must be created.", if /etc/mtab is missing.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
Closes #4680 
Closes #5029
This commit is contained in:
slashdd
2016-09-20 13:07:58 -04:00
committed by Brian Behlendorf
parent 25e2ab16be
commit 792517389f
13 changed files with 53 additions and 43 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
#undef MNTTAB
#endif /* MNTTAB */
#define MNTTAB "/etc/mtab"
#define MNTTAB "/proc/self/mounts"
#define MNT_LINE_MAX 4096
#define MNT_TOOLONG 1 /* entry exceeds MNT_LINE_MAX */
+6 -5
View File
@@ -1908,9 +1908,9 @@ zfs_unset_recvd_props_mode(zfs_handle_t *zhp, uint64_t *cookie)
* zfs_prop_get_int() are built using this interface.
*
* Certain properties can be overridden using 'mount -o'. In this case, scan
* the contents of the /etc/mtab entry, searching for the appropriate options.
* If they differ from the on-disk values, report the current values and mark
* the source "temporary".
* the contents of the /proc/self/mounts entry, searching for the
* appropriate options. If they differ from the on-disk values, report the
* current values and mark the source "temporary".
*/
static int
get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
@@ -1981,8 +1981,9 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
/*
* Because looking up the mount options is potentially expensive
* (iterating over all of /etc/mtab), we defer its calculation until
* we're looking up a property which requires its presence.
* (iterating over all of /proc/self/mounts), we defer its
* calculation until we're looking up a property which requires
* its presence.
*/
if (!zhp->zfs_mntcheck &&
(mntopt_on != NULL || prop == ZFS_PROP_MOUNTED)) {
+4 -4
View File
@@ -347,8 +347,8 @@ zfs_add_option(zfs_handle_t *zhp, char *options, int len,
return (0);
/*
* zfs_prop_get_int() to not used to ensure our mount options
* are not influenced by the current /etc/mtab contents.
* zfs_prop_get_int() is not used to ensure our mount options
* are not influenced by the current /proc/self/mounts contents.
*/
value = getprop_uint64(zhp, prop, &source);
@@ -1184,8 +1184,8 @@ mountpoint_compare(const void *a, const void *b)
* Unshare and unmount all datasets within the given pool. We don't want to
* rely on traversing the DSL to discover the filesystems within the pool,
* because this may be expensive (if not all of them are mounted), and can fail
* arbitrarily (on I/O error, for example). Instead, we walk /etc/mtab and
* gather all the filesystems that are currently mounted.
* arbitrarily (on I/O error, for example). Instead, we walk /proc/self/mounts
* and gather all the filesystems that are currently mounted.
*/
int
zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
+3 -3
View File
@@ -67,9 +67,9 @@ libzfs_error_init(int error)
"loaded.\nTry running '/sbin/modprobe zfs' as root "
"to load them.\n"));
case ENOENT:
return (dgettext(TEXT_DOMAIN, "The /dev/zfs device is "
"missing and must be created.\nTry running 'udevadm "
"trigger' as root to create it.\n"));
return (dgettext(TEXT_DOMAIN, "/dev/zfs and /proc/self/mounts "
"are required.\nTry running 'udevadm trigger' and 'mount "
"-t proc proc /proc' as root.\n"));
case ENOEXEC:
return (dgettext(TEXT_DOMAIN, "The ZFS modules cannot be "
"auto-loaded.\nTry running '/sbin/modprobe zfs' as "