diff mbox series

[77/79] security: switch to new ctime accessors

Message ID 20230621144735.55953-76-jlayton@kernel.org (mailing list archive)
State Handled Elsewhere
Headers show
Series None | expand

Commit Message

Jeff Layton June 21, 2023, 2:46 p.m. UTC
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@kernel.org>
---
 security/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Moore June 23, 2023, 2:15 p.m. UTC | #1
On Wed, Jun 21, 2023 at 10:49 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> 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@kernel.org>
> ---
>  security/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/inode.c b/security/inode.c
> index 6c326939750d..086280390793 100644
> --- a/security/inode.c
> +++ b/security/inode.c
> @@ -145,7 +145,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
>
>         inode->i_ino = get_next_ino();
>         inode->i_mode = mode;
> -       inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> +       inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);

In the process of looking at inode_ctime_set_current() I ran into the
same bug others noticed regarding inode_set_ctime()/inode_ctime_set();
assuming that gets fixed this looks fine to me.

Acked-by: Paul Moore <paul@paul-moore.com>

>         inode->i_private = data;
>         if (S_ISDIR(mode)) {
>                 inode->i_op = &simple_dir_inode_operations;
> --
> 2.41.0
diff mbox series

Patch

diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..086280390793 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -145,7 +145,7 @@  static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
 
 	inode->i_ino = get_next_ino();
 	inode->i_mode = mode;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+	inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
 	inode->i_private = data;
 	if (S_ISDIR(mode)) {
 		inode->i_op = &simple_dir_inode_operations;