lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jun 2023 18:39:31 +0200
From:   Jan Kara <jack@...e.cz>
To:     Jeff Layton <jlayton@...nel.org>
Cc:     Christian Brauner <brauner@...nel.org>,
        David Sterba <dsterba@...e.com>,
        Al Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/79] affs: switch to new ctime accessors

On Wed 21-06-23 10:45:23, Jeff Layton 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@...nel.org>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/affs/amigaffs.c |  6 +++---
>  fs/affs/inode.c    | 17 +++++++++--------
>  2 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
> index 29f11e10a7c7..2b508aa6707e 100644
> --- a/fs/affs/amigaffs.c
> +++ b/fs/affs/amigaffs.c
> @@ -60,7 +60,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
>  	mark_buffer_dirty_inode(dir_bh, dir);
>  	affs_brelse(dir_bh);
>  
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>  	inode_inc_iversion(dir);
>  	mark_inode_dirty(dir);
>  
> @@ -114,7 +114,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
>  
>  	affs_brelse(bh);
>  
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>  	inode_inc_iversion(dir);
>  	mark_inode_dirty(dir);
>  
> @@ -315,7 +315,7 @@ affs_remove_header(struct dentry *dentry)
>  	else
>  		clear_nlink(inode);
>  	affs_unlock_link(inode);
> -	inode->i_ctime = current_time(inode);
> +	inode_ctime_set_current(inode);
>  	mark_inode_dirty(inode);
>  
>  done:
> diff --git a/fs/affs/inode.c b/fs/affs/inode.c
> index 27f77a52c5c8..177bac4def5e 100644
> --- a/fs/affs/inode.c
> +++ b/fs/affs/inode.c
> @@ -19,6 +19,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
>  {
>  	struct affs_sb_info	*sbi = AFFS_SB(sb);
>  	struct buffer_head	*bh;
> +	struct timespec64	ctime;
>  	struct affs_tail	*tail;
>  	struct inode		*inode;
>  	u32			 block;
> @@ -149,13 +150,13 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
>  		break;
>  	}
>  
> -	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec
> -		       = (be32_to_cpu(tail->change.days) * 86400LL +
> -		         be32_to_cpu(tail->change.mins) * 60 +
> -			 be32_to_cpu(tail->change.ticks) / 50 +
> -			 AFFS_EPOCH_DELTA) +
> -			 sys_tz.tz_minuteswest * 60;
> -	inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0;
> +	ctime.tv_sec = (be32_to_cpu(tail->change.days) * 86400LL +
> +		        be32_to_cpu(tail->change.mins) * 60 +
> +			be32_to_cpu(tail->change.ticks) / 50 +
> +			AFFS_EPOCH_DELTA) +
> +			sys_tz.tz_minuteswest * 60;
> +	ctime.tv_nsec = 0;
> +	inode->i_atime = inode->i_mtime = inode_ctime_set(inode, ctime);
>  	affs_brelse(bh);
>  	unlock_new_inode(inode);
>  	return inode;
> @@ -314,7 +315,7 @@ affs_new_inode(struct inode *dir)
>  	inode->i_gid     = current_fsgid();
>  	inode->i_ino     = block;
>  	set_nlink(inode, 1);
> -	inode->i_mtime   = inode->i_atime = inode->i_ctime = current_time(inode);
> +	inode->i_mtime   = inode->i_atime = inode_ctime_set_current(inode);
>  	atomic_set(&AFFS_I(inode)->i_opencnt, 0);
>  	AFFS_I(inode)->i_blkcnt = 0;
>  	AFFS_I(inode)->i_lc = NULL;
> -- 
> 2.41.0
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ