]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
vfs: add generic nocmtime mount flag
authorZach Brown <zab@zabbo.net>
Fri, 15 May 2015 21:23:47 +0000 (14:23 -0700)
committerSage Weil <sage@redhat.com>
Tue, 11 Aug 2015 20:12:47 +0000 (16:12 -0400)
Add the infrastructure to support a generic nocmtime mount flag.  Like
MS_NOATIME/MNT_NOATIME this can be used to support the mount option in
file systems without having to touch each file system.

This will be used to provide a priviledged indication that unpriviledged
apps can safely use O_NOCMTIME to prevent cmtime updates without harm.

Signed-off-by: Zach Brown <zab@zabbo.net>
fs/namespace.c
fs/proc_namespace.c
fs/statfs.c
include/linux/mount.h
include/linux/statfs.h
include/uapi/linux/fs.h

index 1b9e11167baedc310b8f5b6585ac019abd78b915..48be1f9ec2a7caee357ca3b6bb25e4aaa3d1b022 100644 (file)
@@ -2652,6 +2652,8 @@ long do_mount(const char *dev_name, const char __user *dir_name,
                mnt_flags |= MNT_NOEXEC;
        if (flags & MS_NOATIME)
                mnt_flags |= MNT_NOATIME;
+       if (flags & MS_NOCMTIME)
+               mnt_flags |= MNT_NOCMTIME;
        if (flags & MS_NODIRATIME)
                mnt_flags |= MNT_NODIRATIME;
        if (flags & MS_STRICTATIME)
index 8db932da40091b44f2a8df49e921d942f2291908..49d78396be2dece1e9b5490219276a2faf627b90 100644 (file)
@@ -64,6 +64,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
                { MNT_NODEV, ",nodev" },
                { MNT_NOEXEC, ",noexec" },
                { MNT_NOATIME, ",noatime" },
+               { MNT_NOCMTIME, ",nocmtime" },
                { MNT_NODIRATIME, ",nodiratime" },
                { MNT_RELATIME, ",relatime" },
                { 0, NULL }
index 083dc0ac91408870254cac60ed4b06580deba610..43d3de25ebb7b5f3149b79ea9193440f0e7fbbdf 100644 (file)
@@ -23,6 +23,8 @@ static int flags_by_mnt(int mnt_flags)
                flags |= ST_NOEXEC;
        if (mnt_flags & MNT_NOATIME)
                flags |= ST_NOATIME;
+       if (mnt_flags & MNT_NOCMTIME)
+               flags |= ST_NOCMTIME;
        if (mnt_flags & MNT_NODIRATIME)
                flags |= ST_NODIRATIME;
        if (mnt_flags & MNT_RELATIME)
index f822c3c113777113958418a4cb4fdca4151ad21f..deb458f1cfc3ed0f259b167e88f50283f9b0e291 100644 (file)
@@ -28,6 +28,7 @@ struct mnt_namespace;
 #define MNT_NODIRATIME 0x10
 #define MNT_RELATIME   0x20
 #define MNT_READONLY   0x40    /* does the user want this to be r/o? */
+#define MNT_NOCMTIME   0x80    /* allow O_NOCMTIME to stop cmtime updates */
 
 #define MNT_SHRINKABLE 0x100
 #define MNT_WRITE_HOLD 0x200
index 0166d320a75d3565e32fb6c368a36cbb5a6f0596..bde224e35f580392a1b9d17a1248d84d99c159a4 100644 (file)
@@ -39,5 +39,6 @@ struct kstatfs {
 #define ST_NOATIME     0x0400  /* do not update access times */
 #define ST_NODIRATIME  0x0800  /* do not update directory access times */
 #define ST_RELATIME    0x1000  /* update atime relative to mtime/ctime */
+#define ST_NOCMTIME    0x2000  /* allow O_NOCMTIME to stop cmtime updates */
 
 #endif
index 9b964a5920afbaca68d2e3976e883b4fba54f4ba..af1131e0cbdaacd02c8f5ea28a66b30301adf7f3 100644 (file)
@@ -91,6 +91,7 @@ struct inodes_stat_t {
 #define MS_I_VERSION   (1<<23) /* Update inode I_version field */
 #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
 #define MS_LAZYTIME    (1<<25) /* Update the on-disk [acm]times lazily */
+#define MS_NOCMTIME    (1<<26) /* allow O_NOCMTIME to stop cmtime updates */
 
 /* These sb flags are internal to the kernel */
 #define MS_NOSEC       (1<<28)