summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-07-30 15:38:02 -0700
committerBrian Behlendorf <[email protected]>2012-07-30 15:58:02 -0700
commitc171ea71bbedde9c30c39ce96d555bfd585e49a2 (patch)
tree912e0bb475142ef75dc91e9f185208d5c8719613
parent4ab8a725ce8a2bcf26a9df6902f8ee893e62fe6e (diff)
Allow '-o remount' for non-legacy datasets
This is done for compatibility with existing Linux infrastructure. In particular, when using zfs as a root filesystem there are init scripts which as part of shutdown remount root read-only. Also, the new systemd infrastructure being used by Fedora expects to be able to remount a file system read-write. Signed-off-by: Brian Behlendorf <[email protected]> Issue #847
-rw-r--r--cmd/mount_zfs/mount_zfs.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
index 45c291e04..0a69d69d7 100644
--- a/cmd/mount_zfs/mount_zfs.c
+++ b/cmd/mount_zfs/mount_zfs.c
@@ -312,7 +312,7 @@ main(int argc, char **argv)
char badopt[MNT_LINE_MAX] = { '\0' };
char mtabopt[MNT_LINE_MAX] = { '\0' };
char *dataset, *mntpoint;
- unsigned long mntflags = 0, zfsflags = 0, remount_ro = 0;
+ unsigned long mntflags = 0, zfsflags = 0, remount = 0;
int sloppy = 0, fake = 0, verbose = 0, nomtab = 0, zfsutil = 0;
int error, c;
@@ -417,11 +417,10 @@ main(int argc, char **argv)
" mountopts: \"%s\"\n mtabopts: \"%s\"\n"),
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);
- if (mntflags & MS_REMOUNT)
+ if (mntflags & MS_REMOUNT) {
nomtab = 1;
-
- if ((mntflags & MS_REMOUNT) && (mntflags & MS_RDONLY))
- remount_ro = 1;
+ remount = 1;
+ }
if (zfsflags & ZS_ZFSUTIL)
zfsutil = 1;
@@ -454,9 +453,10 @@ main(int argc, char **argv)
* we differentiate the two cases using the 'zfsutil' mount option.
* This mount option should only be supplied by the 'zfs mount' util.
*
- * The only exception to the above rule is '-o remount,ro'. This is
- * always allowed for non-legacy datasets for rc.sysinit/umountroot
- * to safely remount the root filesystem and flush its cache.
+ * The only exception to the above rule is '-o remount' which is
+ * always allowed for non-legacy datasets. This is done because when
+ * using zfs as your root file system both rc.sysinit/umountroot and
+ * systemd depend on 'mount -o remount <mountpoint>' to work.
*/
if (zfsutil && !strcmp(legacy, ZFS_MOUNTPOINT_LEGACY)) {
(void) fprintf(stderr, gettext(
@@ -467,7 +467,7 @@ main(int argc, char **argv)
return (MOUNT_USAGE);
}
- if (!zfsutil && strcmp(legacy, ZFS_MOUNTPOINT_LEGACY) && !remount_ro) {
+ if (!zfsutil && strcmp(legacy, ZFS_MOUNTPOINT_LEGACY) && !remount) {
(void) fprintf(stderr, gettext(
"filesystem '%s' cannot be mounted using 'mount'.\n"
"Use 'zfs set mountpoint=%s' or 'zfs mount %s'.\n"