]> granicus.if.org Git - zfs/commitdiff
Make zfs mount according to relatime config in dataset
authorChunwei Chen <david.chen@osnexus.com>
Fri, 1 Apr 2016 20:12:06 +0000 (13:12 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 6 Apr 2016 01:55:59 +0000 (18:55 -0700)
Also enable lazytime in mount.zfs

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #4482

cmd/mount_zfs/mount_zfs.c
include/sys/mntent.h
lib/libzfs/libzfs_mount.c

index 3a0462127edf6726471a7b6e2eca7515d9dce07b..b78c91c7ccfd439df51c4996c7f7cf564da5c909 100644 (file)
@@ -78,7 +78,10 @@ static const option_map_t option_map[] = {
        { MNTOPT_RELATIME,      MS_RELATIME,    ZS_COMMENT      },
 #endif
 #ifdef MS_STRICTATIME
-       { MNTOPT_DFRATIME,      MS_STRICTATIME, ZS_COMMENT      },
+       { MNTOPT_STRICTATIME,   MS_STRICTATIME, ZS_COMMENT      },
+#endif
+#ifdef MS_LAZYTIME
+       { MNTOPT_LAZYTIME,      MS_LAZYTIME,    ZS_COMMENT      },
 #endif
        { MNTOPT_CONTEXT,       MS_COMMENT,     ZS_COMMENT      },
        { MNTOPT_FSCONTEXT,     MS_COMMENT,     ZS_COMMENT      },
index 7284f05b1db22120a523a5758c647826073f2aaf..fac751b462bc41bba65d384cd50c41f43545e725 100644 (file)
@@ -68,8 +68,9 @@
 #define        MNTOPT_NOFAIL   "nofail"        /* no failure */
 #define        MNTOPT_RELATIME "relatime"      /* allow relative time updates */
 #define        MNTOPT_NORELATIME "norelatime"  /* do not allow relative time updates */
-#define        MNTOPT_DFRATIME "strictatime"   /* Deferred access time updates */
-#define        MNTOPT_NODFRATIME "nostrictatime" /* No Deferred access time updates */
+#define        MNTOPT_STRICTATIME "strictatime" /* strict access time updates */
+#define        MNTOPT_NOSTRICTATIME "nostrictatime" /* No strict access time updates */
+#define        MNTOPT_LAZYTIME "lazytime"      /* Defer access time writing */
 #define        MNTOPT_SETUID   "suid"          /* Both setuid and devices allowed */
 #define        MNTOPT_NOSETUID "nosuid"        /* Neither setuid nor devices allowed */
 #define        MNTOPT_OWNER    "owner"         /* allow owner mount */
index b6c47a25daba39e590230999194746d594147f68..29907dc8bfac441027386c9268a0c16f47083d5f 100644 (file)
@@ -365,6 +365,14 @@ zfs_add_options(zfs_handle_t *zhp, char *options, int len)
 
        error = zfs_add_option(zhp, options, len,
            ZFS_PROP_ATIME, MNTOPT_ATIME, MNTOPT_NOATIME);
+       /*
+        * don't add relatime/strictatime when atime=off, otherwise strictatime
+        * will force atime=on
+        */
+       if (strstr(options, MNTOPT_NOATIME) == NULL) {
+               error = zfs_add_option(zhp, options, len,
+                   ZFS_PROP_RELATIME, MNTOPT_RELATIME, MNTOPT_STRICTATIME);
+       }
        error = error ? error : zfs_add_option(zhp, options, len,
            ZFS_PROP_DEVICES, MNTOPT_DEVICES, MNTOPT_NODEVICES);
        error = error ? error : zfs_add_option(zhp, options, len,