diff options
author | Deepa Dinamani <deepa.kernel@gmail.com> | 2016-09-14 07:48:04 -0700 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-27 21:06:21 -0400 |
commit | 078cd8279e659989b103359bb22373cc79445bde (patch) | |
tree | 923e3fe84d232cc9ba31481852ea1faf46f56fb6 /ipc | |
parent | 2554c72edb81c97ae5307613dd0aee1ef8dd13ca (diff) |
fs: Replace CURRENT_TIME with current_time() for inode timestamps
CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_time() instead.
CURRENT_TIME is also not y2038 safe.
This is also in preparation for the patch that transitions
vfs timestamps to use 64 bit time and hence make them
y2038 safe. As part of the effort current_time() will be
extended to do range checks. Hence, it is necessary for all
file system timestamps to use current_time(). Also,
current_time() will be transitioned along with vfs to be
y2038 safe.
Note that whenever a single call to current_time() is used
to change timestamps in different inodes, it is because they
share the same time granularity.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Felipe Balbi <balbi@kernel.org>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Acked-by: David Sterba <dsterba@suse.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/mqueue.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 0b13ace266f2..8cbd6e6894d5 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -225,7 +225,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb, inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - inode->i_mtime = inode->i_ctime = inode->i_atime = CURRENT_TIME; + inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode); if (S_ISREG(mode)) { struct mqueue_inode_info *info; @@ -446,7 +446,7 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry, put_ipc_ns(ipc_ns); dir->i_size += DIRENT_SIZE; - dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; + dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); d_instantiate(dentry, inode); dget(dentry); @@ -462,7 +462,7 @@ static int mqueue_unlink(struct inode *dir, struct dentry *dentry) { struct inode *inode = d_inode(dentry); - dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; + dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); dir->i_size -= DIRENT_SIZE; drop_nlink(inode); dput(dentry); @@ -500,7 +500,7 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data, if (ret <= 0) return ret; - file_inode(filp)->i_atime = file_inode(filp)->i_ctime = CURRENT_TIME; + file_inode(filp)->i_atime = file_inode(filp)->i_ctime = current_time(file_inode(filp)); return ret; } @@ -1060,7 +1060,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, __do_notify(info); } inode->i_atime = inode->i_mtime = inode->i_ctime = - CURRENT_TIME; + current_time(inode); } out_unlock: spin_unlock(&info->lock); @@ -1156,7 +1156,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, msg_ptr = msg_get(info); inode->i_atime = inode->i_mtime = inode->i_ctime = - CURRENT_TIME; + current_time(inode); /* There is now free space in queue. */ pipelined_receive(&wake_q, info); @@ -1277,7 +1277,7 @@ retry: if (u_notification == NULL) { if (info->notify_owner == task_tgid(current)) { remove_notification(info); - inode->i_atime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_ctime = current_time(inode); } } else if (info->notify_owner != NULL) { ret = -EBUSY; @@ -1302,7 +1302,7 @@ retry: info->notify_owner = get_pid(task_tgid(current)); info->notify_user_ns = get_user_ns(current_user_ns()); - inode->i_atime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_ctime = current_time(inode); } spin_unlock(&info->lock); out_fput: @@ -1359,7 +1359,7 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, f.file->f_flags &= ~O_NONBLOCK; spin_unlock(&f.file->f_lock); - inode->i_atime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_ctime = current_time(inode); } spin_unlock(&info->lock); |