#include <asm/siginfo.h>
#include <asm/uaccess.h>
-#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
+#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME | \
+ O_NOMTIME)
static int setfl(int fd, struct file * filp, unsigned long arg)
{
if (((arg ^ filp->f_flags) & O_APPEND) && IS_APPEND(inode))
return -EPERM;
- /* O_NOATIME can only be set by the owner or superuser */
- if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))
+ /* O_NOATIME and O_NOMTIME can only be set by the owner or superuser */
+ if (((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) ||
+ ((arg & O_NOMTIME) && !(filp->f_flags & O_NOMTIME)))
if (!inode_owner_or_capable(inode))
return -EPERM;
* Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
* is defined as O_NONBLOCK on some platforms and not on others.
*/
- BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
+ BUILD_BUG_ON(22 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
O_RDONLY | O_WRONLY | O_RDWR |
O_CREAT | O_EXCL | O_NOCTTY |
O_TRUNC | O_APPEND | /* O_NONBLOCK | */
O_DIRECT | O_LARGEFILE | O_DIRECTORY |
O_NOFOLLOW | O_NOATIME | O_CLOEXEC |
__FMODE_EXEC | O_PATH | __O_TMPFILE |
- __FMODE_NONOTIFY
+ __FMODE_NONOTIFY| O_NOMTIME
));
fasync_cache = kmem_cache_create("fasync_cache",
int ret;
/* First try to exhaust all avenues to not sync */
- if (IS_NOCMTIME(inode))
+ if (IS_NOCMTIME(inode) || (file->f_flags & O_NOMTIME))
return 0;
now = current_fs_time(inode->i_sb);
return -EPERM;
}
- /* O_NOATIME can only be set by the owner or superuser */
- if (flag & O_NOATIME && !inode_owner_or_capable(inode))
+ /* O_NOATIME and O_NOMTIME can only be set by the owner or superuser */
+ if (flag & (O_NOATIME|O_NOMTIME) && !inode_owner_or_capable(inode))
return -EPERM;
return 0;
/* 64bit hashes as llseek() offset (for directories) */
#define FMODE_64BITHASH ((__force fmode_t)0x400)
-/*
- * Don't update ctime and mtime.
- *
- * Currently a special hack for the XFS open_by_handle ioctl, but we'll
- * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
- */
+/* Don't update ctime and mtime. */
#define FMODE_NOCMTIME ((__force fmode_t)0x800)
/* Expect random access pattern */
#define __O_TMPFILE 020000000
#endif
+#ifndef O_NOMTIME
+#define O_NOMTIME 040000000
+#endif
+
/* a horrid kludge trying to make sure that this will fail on old kernels */
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)