[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230621144735.55953-71-jlayton@kernel.org>
Date: Wed, 21 Jun 2023 10:46:25 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Christian Brauner <brauner@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
linux-kernel@...r.kernel.org
Subject: [PATCH 72/79] mqueue: switch to new ctime accessors
In later patches, we're going to change how the ctime.tv_nsec field is
utilized. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
ipc/mqueue.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 71881bddad25..dd8564be3894 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -302,7 +302,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);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
@@ -596,7 +596,7 @@ static int mqueue_create_attr(struct dentry *dentry, umode_t mode, void *arg)
put_ipc_ns(ipc_ns);
dir->i_size += DIRENT_SIZE;
- dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
+ inode_ctime_set(dir, dir->i_mtime = dir->i_atime = current_time(dir));
d_instantiate(dentry, inode);
dget(dentry);
@@ -618,7 +618,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);
+ inode_ctime_set(dir, dir->i_mtime = dir->i_atime = current_time(dir));
dir->i_size -= DIRENT_SIZE;
drop_nlink(inode);
dput(dentry);
@@ -656,7 +656,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));
+ file_inode(filp)->i_atime = inode_ctime_set_current(file_inode(filp));
return ret;
}
@@ -1162,8 +1162,7 @@ static int do_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr,
goto out_unlock;
__do_notify(info);
}
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
}
out_unlock:
spin_unlock(&info->lock);
@@ -1257,8 +1256,7 @@ static int do_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(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
/* There is now free space in queue. */
pipelined_receive(&wake_q, info);
@@ -1396,7 +1394,7 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
if (notification == NULL) {
if (info->notify_owner == task_tgid(current)) {
remove_notification(info);
- inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode_ctime_set_current(inode);
}
} else if (info->notify_owner != NULL) {
ret = -EBUSY;
@@ -1422,7 +1420,7 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
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);
+ inode->i_atime = inode_ctime_set_current(inode);
}
spin_unlock(&info->lock);
out_fput:
@@ -1485,7 +1483,7 @@ static int do_mq_getsetattr(int mqdes, struct mq_attr *new, struct mq_attr *old)
f.file->f_flags &= ~O_NONBLOCK;
spin_unlock(&f.file->f_lock);
- inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode_ctime_set_current(inode);
}
spin_unlock(&info->lock);
--
2.41.0
Powered by blists - more mailing lists