Skip to content

Commit

Permalink
ipc: convert to new timestamp accessors
Browse files Browse the repository at this point in the history
Convert to using the new inode timestamp accessor functions.

Signed-off-by: Jeff Layton <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
jtlayton authored and brauner committed Oct 18, 2023
1 parent 1f69326 commit d162a3c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_atime = inode_set_ctime_current(inode);
simple_inode_init_ts(inode);

if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
Expand Down Expand Up @@ -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_mtime = dir->i_atime = inode_set_ctime_current(dir);
simple_inode_init_ts(dir);

d_instantiate(dentry, inode);
dget(dentry);
Expand All @@ -618,7 +618,7 @@ static int mqueue_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);

dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir);
simple_inode_init_ts(dir);
dir->i_size -= DIRENT_SIZE;
drop_nlink(inode);
dput(dentry);
Expand Down Expand Up @@ -657,7 +657,7 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data,
if (ret <= 0)
return ret;

inode->i_atime = inode_set_ctime_current(inode);
inode_set_atime_to_ts(inode, inode_set_ctime_current(inode));
return ret;
}

Expand Down Expand Up @@ -1163,7 +1163,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_set_ctime_current(inode);
simple_inode_init_ts(inode);
}
out_unlock:
spin_unlock(&info->lock);
Expand Down Expand Up @@ -1257,7 +1257,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_set_ctime_current(inode);
simple_inode_init_ts(inode);

/* There is now free space in queue. */
pipelined_receive(&wake_q, info);
Expand Down Expand Up @@ -1395,7 +1395,8 @@ 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_set_ctime_current(inode);
inode_set_atime_to_ts(inode,
inode_set_ctime_current(inode));
}
} else if (info->notify_owner != NULL) {
ret = -EBUSY;
Expand All @@ -1421,7 +1422,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_set_ctime_current(inode);
inode_set_atime_to_ts(inode, inode_set_ctime_current(inode));
}
spin_unlock(&info->lock);
out_fput:
Expand Down Expand Up @@ -1484,7 +1485,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_set_ctime_current(inode);
inode_set_atime_to_ts(inode, inode_set_ctime_current(inode));
}

spin_unlock(&info->lock);
Expand Down

0 comments on commit d162a3c

Please sign in to comment.