aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/mount_zfs/mount_zfs.c5
-rw-r--r--include/sys/mntent.h5
-rw-r--r--lib/libzfs/libzfs_mount.c8
3 files changed, 15 insertions, 3 deletions
diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
index 3a0462127..b78c91c7c 100644
--- a/cmd/mount_zfs/mount_zfs.c
+++ b/cmd/mount_zfs/mount_zfs.c
@@ -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 },
diff --git a/include/sys/mntent.h b/include/sys/mntent.h
index 7284f05b1..fac751b46 100644
--- a/include/sys/mntent.h
+++ b/include/sys/mntent.h
@@ -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 */
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index b6c47a25d..29907dc8b 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -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,