From dba6b3983af34f30de01cf532dff0b66f0ed6045 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Mon, 8 May 2023 16:12:08 -0700 Subject: Do not pass unsupported mount options to the kernel. The filesystem daemon is responsible for implementing eg. st_atime updates, so passing options like relatime to the kernel results in them being silently ignored. Instead, such options need to be interpreted (and filtered out) by the filesystem daemon. --- include/fuse_lowlevel.h | 6 ++++++ lib/mount.c | 13 ------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 6500e29..9142b1c 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -313,6 +313,12 @@ struct fuse_lowlevel_ops { * expected to reset the setuid and setgid bits if the file * size or owner is being changed. * + * This method will not be called to update st_atime or st_ctime implicitly + * (eg. after a read() request), and only be called to implicitly update st_mtime + * if writeback caching is active. It is the filesystem's responsibility to update + * these timestamps when needed, and (if desired) to implement mount options like + * `noatime` or `relatime`. + * * If the setattr was invoked from the ftruncate() system call * under Linux kernel versions 2.6.15 or later, the fi->fh will * contain the value set by the open method or will be undefined diff --git a/lib/mount.c b/lib/mount.c index 9c233a3..d71e6fc 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -111,15 +111,8 @@ static const struct fuse_opt fuse_mount_opts[] = { FUSE_OPT_KEY("async", KEY_KERN_FLAG), FUSE_OPT_KEY("sync", KEY_KERN_FLAG), FUSE_OPT_KEY("dirsync", KEY_KERN_FLAG), - FUSE_OPT_KEY("atime", KEY_KERN_FLAG), FUSE_OPT_KEY("noatime", KEY_KERN_FLAG), - FUSE_OPT_KEY("diratime", KEY_KERN_FLAG), FUSE_OPT_KEY("nodiratime", KEY_KERN_FLAG), - FUSE_OPT_KEY("lazytime", KEY_KERN_FLAG), - FUSE_OPT_KEY("nolazytime", KEY_KERN_FLAG), - FUSE_OPT_KEY("relatime", KEY_KERN_FLAG), - FUSE_OPT_KEY("norelatime", KEY_KERN_FLAG), - FUSE_OPT_KEY("strictatime", KEY_KERN_FLAG), FUSE_OPT_KEY("nostrictatime", KEY_KERN_FLAG), FUSE_OPT_END }; @@ -158,15 +151,9 @@ static const struct mount_flags mount_flags[] = { {"noexec", MS_NOEXEC, 1}, {"async", MS_SYNCHRONOUS, 0}, {"sync", MS_SYNCHRONOUS, 1}, - {"atime", MS_NOATIME, 0}, {"noatime", MS_NOATIME, 1}, - {"diratime", MS_NODIRATIME, 0}, {"nodiratime", MS_NODIRATIME, 1}, - {"lazytime", MS_LAZYTIME, 1}, - {"nolazytime", MS_LAZYTIME, 0}, - {"relatime", MS_RELATIME, 1}, {"norelatime", MS_RELATIME, 0}, - {"strictatime", MS_STRICTATIME, 1}, {"nostrictatime", MS_STRICTATIME, 0}, #ifndef __NetBSD__ {"dirsync", MS_DIRSYNC, 1}, -- cgit v1.2.1