mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Talpey <tom@talpey.com>
To: Jeff Layton <jlayton@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Steve French <sfrench@samba.org>,
	Paulo Alcantara <pc@manguebit.com>,
	Ronnie Sahlberg <lsahlber@redhat.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 62/79] smb: switch to new ctime accessors
Date: Wed, 21 Jun 2023 13:45:22 -0400	[thread overview]
Message-ID: <d32dab41-6d98-a45c-0238-e17c5a0b4d11@talpey.com> (raw)
In-Reply-To: <20230621144735.55953-61-jlayton@kernel.org>

On 6/21/2023 10:46 AM, 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@kernel.org>

Acked-by: Tom Talpey <tom@talpey.com>

> ---
>   fs/smb/client/file.c    |  4 ++--
>   fs/smb/client/fscache.h |  5 +++--
>   fs/smb/client/inode.c   | 15 +++++++--------
>   fs/smb/client/smb2ops.c |  2 +-
>   fs/smb/server/smb2pdu.c |  8 ++++----
>   5 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
> index 0a5fe8d5314b..07fed94b7501 100644
> --- a/fs/smb/client/file.c
> +++ b/fs/smb/client/file.c
> @@ -1085,7 +1085,7 @@ int cifs_close(struct inode *inode, struct file *file)
>   		    !test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) &&
>   		    dclose) {
>   			if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {
> -				inode->i_ctime = inode->i_mtime = current_time(inode);
> +				inode->i_mtime = inode_ctime_set_current(inode);
>   			}
>   			spin_lock(&cinode->deferred_lock);
>   			cifs_add_deferred_close(cfile, dclose);
> @@ -2596,7 +2596,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
>   					   write_data, to - from, &offset);
>   		cifsFileInfo_put(open_file);
>   		/* Does mm or vfs already set times? */
> -		inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> +		inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
>   		if ((bytes_written > 0) && (offset))
>   			rc = 0;
>   		else if (bytes_written < 0)
> diff --git a/fs/smb/client/fscache.h b/fs/smb/client/fscache.h
> index 173999610997..1c50d286c3a4 100644
> --- a/fs/smb/client/fscache.h
> +++ b/fs/smb/client/fscache.h
> @@ -50,12 +50,13 @@ void cifs_fscache_fill_coherency(struct inode *inode,
>   				 struct cifs_fscache_inode_coherency_data *cd)
>   {
>   	struct cifsInodeInfo *cifsi = CIFS_I(inode);
> +	struct timespec64 ctime = inode_ctime_peek(&cifsi->netfs.inode);
>   
>   	memset(cd, 0, sizeof(*cd));
>   	cd->last_write_time_sec   = cpu_to_le64(cifsi->netfs.inode.i_mtime.tv_sec);
>   	cd->last_write_time_nsec  = cpu_to_le32(cifsi->netfs.inode.i_mtime.tv_nsec);
> -	cd->last_change_time_sec  = cpu_to_le64(cifsi->netfs.inode.i_ctime.tv_sec);
> -	cd->last_change_time_nsec = cpu_to_le32(cifsi->netfs.inode.i_ctime.tv_nsec);
> +	cd->last_change_time_sec  = cpu_to_le64(ctime.tv_sec);
> +	cd->last_change_time_nsec = cpu_to_le32(ctime.tv_nsec);
>   }
>   
>   
> diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> index 1087ac6104a9..d986b280b6c3 100644
> --- a/fs/smb/client/inode.c
> +++ b/fs/smb/client/inode.c
> @@ -172,7 +172,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
>   	else
>   		inode->i_atime = fattr->cf_atime;
>   	inode->i_mtime = fattr->cf_mtime;
> -	inode->i_ctime = fattr->cf_ctime;
> +	inode_ctime_set(inode, fattr->cf_ctime);
>   	inode->i_rdev = fattr->cf_rdev;
>   	cifs_nlink_fattr_to_inode(inode, fattr);
>   	inode->i_uid = fattr->cf_uid;
> @@ -1744,9 +1744,9 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
>   		cifs_inode = CIFS_I(inode);
>   		cifs_inode->time = 0;	/* will force revalidate to get info
>   					   when needed */
> -		inode->i_ctime = current_time(inode);
> +		inode_ctime_set_current(inode);
>   	}
> -	dir->i_ctime = dir->i_mtime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>   	cifs_inode = CIFS_I(dir);
>   	CIFS_I(dir)->time = 0;	/* force revalidate of dir as well */
>   unlink_out:
> @@ -2060,8 +2060,8 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
>   	 */
>   	cifsInode->time = 0;
>   
> -	d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime =
> -		current_time(inode);
> +	inode->i_mtime = inode_ctime_set_current(inode);
> +	inode_ctime_set(d_inode(direntry), inode->i_mtime);
>   
>   rmdir_exit:
>   	free_dentry_path(page);
> @@ -2267,9 +2267,8 @@ cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir,
>   	/* force revalidate to go get info when needed */
>   	CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0;
>   
> -	source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime =
> -		target_dir->i_mtime = current_time(source_dir);
> -
> +	source_dir->i_mtime = inode_ctime_set_current(source_dir);
> +	target_dir->i_mtime = inode_ctime_set_current(target_dir);
>   cifs_rename_exit:
>   	kfree(info_buf_source);
>   	free_dentry_path(page2);
> diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
> index 5639d8c48570..52564a5dd2b1 100644
> --- a/fs/smb/client/smb2ops.c
> +++ b/fs/smb/client/smb2ops.c
> @@ -1391,7 +1391,7 @@ smb2_close_getattr(const unsigned int xid, struct cifs_tcon *tcon,
>   	if (file_inf.LastWriteTime)
>   		inode->i_mtime = cifs_NTtimeToUnix(file_inf.LastWriteTime);
>   	if (file_inf.ChangeTime)
> -		inode->i_ctime = cifs_NTtimeToUnix(file_inf.ChangeTime);
> +		inode_ctime_set(inode, cifs_NTtimeToUnix(file_inf.ChangeTime));
>   	if (file_inf.LastAccessTime)
>   		inode->i_atime = cifs_NTtimeToUnix(file_inf.LastAccessTime);
>   
> diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
> index d31926194ebf..7a741ab6835c 100644
> --- a/fs/smb/server/smb2pdu.c
> +++ b/fs/smb/server/smb2pdu.c
> @@ -4768,7 +4768,7 @@ static int find_file_posix_info(struct smb2_query_info_rsp *rsp,
>   	file_info->LastAccessTime = cpu_to_le64(time);
>   	time = ksmbd_UnixTimeToNT(inode->i_mtime);
>   	file_info->LastWriteTime = cpu_to_le64(time);
> -	time = ksmbd_UnixTimeToNT(inode->i_ctime);
> +	time = ksmbd_UnixTimeToNT(inode_ctime_peek(inode));
>   	file_info->ChangeTime = cpu_to_le64(time);
>   	file_info->DosAttributes = fp->f_ci->m_fattr;
>   	file_info->Inode = cpu_to_le64(inode->i_ino);
> @@ -5409,7 +5409,7 @@ int smb2_close(struct ksmbd_work *work)
>   		rsp->LastAccessTime = cpu_to_le64(time);
>   		time = ksmbd_UnixTimeToNT(inode->i_mtime);
>   		rsp->LastWriteTime = cpu_to_le64(time);
> -		time = ksmbd_UnixTimeToNT(inode->i_ctime);
> +		time = ksmbd_UnixTimeToNT(inode_ctime_peek(inode));
>   		rsp->ChangeTime = cpu_to_le64(time);
>   		ksmbd_fd_put(work, fp);
>   	} else {
> @@ -5628,7 +5628,7 @@ static int set_file_basic_info(struct ksmbd_file *fp,
>   	if (file_info->ChangeTime)
>   		attrs.ia_ctime = ksmbd_NTtimeToUnix(file_info->ChangeTime);
>   	else
> -		attrs.ia_ctime = inode->i_ctime;
> +		attrs.ia_ctime = inode_ctime_peek(inode);
>   
>   	if (file_info->LastWriteTime) {
>   		attrs.ia_mtime = ksmbd_NTtimeToUnix(file_info->LastWriteTime);
> @@ -5673,7 +5673,7 @@ static int set_file_basic_info(struct ksmbd_file *fp,
>   			return -EACCES;
>   
>   		inode_lock(inode);
> -		inode->i_ctime = attrs.ia_ctime;
> +		inode_ctime_set(inode, attrs.ia_ctime);
>   		attrs.ia_valid &= ~ATTR_CTIME;
>   		rc = notify_change(idmap, dentry, &attrs, NULL);
>   		inode_unlock(inode);

  reply	other threads:[~2023-06-21 17:45 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230621144507.55591-1-jlayton@kernel.org>
2023-06-21 14:45 ` [PATCH 02/79] spufs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 03/79] s390: " Jeff Layton
2023-06-21 16:34     ` Jan Kara
2023-06-22 17:35     ` Alexander Gordeev
2023-06-22 17:51       ` Jeff Layton
2023-06-22 18:22         ` Alexander Gordeev
2023-06-22 18:46           ` Jeff Layton
2023-06-21 14:45   ` [PATCH 04/79] binderfs: " Jeff Layton
2023-06-21 15:29     ` Greg Kroah-Hartman
2023-06-21 16:35     ` Jan Kara
2023-06-21 14:45   ` [PATCH 05/79] qib_fs: " Jeff Layton
2023-06-21 16:35     ` Jan Kara
2023-06-21 19:37     ` Dennis Dalessandro
2023-06-21 14:45   ` [PATCH 06/79] ibm: " Jeff Layton
2023-06-21 15:29     ` Greg Kroah-Hartman
2023-06-21 16:35     ` Jan Kara
2023-06-21 14:45   ` [PATCH 07/79] usb: " Jeff Layton
2023-06-21 15:29     ` Greg Kroah-Hartman
2023-06-21 16:36     ` Jan Kara
2023-06-21 14:45   ` [PATCH 08/79] 9p: " Jeff Layton
2023-06-21 16:37     ` Jan Kara
2023-06-21 14:45   ` [PATCH 09/79] adfs: " Jeff Layton
2023-06-21 16:38     ` Jan Kara
2023-06-21 14:45   ` [PATCH 10/79] affs: " Jeff Layton
2023-06-21 16:39     ` Jan Kara
2023-06-22 11:37     ` David Sterba
2023-06-21 14:45   ` [PATCH 11/79] afs: " Jeff Layton
2023-06-21 16:43     ` Jan Kara
2023-06-21 14:45   ` [PATCH 12/79] fs: " Jeff Layton
2023-06-21 16:42     ` Jan Kara
2023-06-21 14:45   ` [PATCH 13/79] autofs: " Jeff Layton
2023-06-21 16:43     ` Jan Kara
2023-06-27  1:48     ` Ian Kent
2023-06-21 14:45   ` [PATCH 14/79] befs: " Jeff Layton
2023-06-21 16:44     ` Jan Kara
2023-06-21 14:45   ` [PATCH 15/79] bfs: " Jeff Layton
2023-06-21 16:48     ` Jan Kara
2023-06-21 16:57       ` Jeff Layton
2023-06-22 12:30         ` Jan Kara
2023-06-22 12:51           ` Jeff Layton
2023-06-22 14:57             ` Jan Kara
2023-06-23 12:33               ` Christian Brauner
2023-07-03 10:12                 ` Christian Brauner
2023-07-03 10:46                   ` Jeff Layton
2023-07-03 10:57                     ` Christian Brauner
2023-06-21 14:45   ` [PATCH 16/79] btrfs: " Jeff Layton
2023-06-22 11:42     ` David Sterba
2023-06-21 14:45   ` [PATCH 17/79] ceph: " Jeff Layton
2023-06-26  0:56     ` Xiubo Li
2023-06-21 14:45   ` [PATCH 18/79] coda: " Jeff Layton
2023-06-21 14:45   ` [PATCH 19/79] configfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 20/79] cramfs: " Jeff Layton
2023-06-21 15:29     ` Nicolas Pitre
2023-06-21 14:45   ` [PATCH 21/79] debugfs: " Jeff Layton
2023-06-21 15:29     ` Greg Kroah-Hartman
2023-06-21 14:45   ` [PATCH 22/79] devpts: " Jeff Layton
2023-06-21 14:45   ` [PATCH 23/79] ecryptfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 24/79] efivarfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 25/79] efs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 26/79] erofs: " Jeff Layton
2023-06-22  4:01     ` Gao Xiang
2023-06-21 14:45   ` [PATCH 27/79] exfat: " Jeff Layton
2023-06-21 14:45   ` [PATCH 28/79] ext2: " Jeff Layton
2023-06-21 14:45   ` [PATCH 29/79] ext4: " Jeff Layton
2023-06-21 14:45   ` [PATCH 30/79] f2fs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 31/79] fat: " Jeff Layton
2023-06-21 14:45   ` [PATCH 32/79] freevxfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 33/79] fuse: " Jeff Layton
2023-06-21 14:45   ` [PATCH 34/79] gfs2: " Jeff Layton
2023-06-21 14:45   ` [PATCH 35/79] hfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 36/79] hfsplus: " Jeff Layton
2023-06-21 14:45   ` [PATCH 37/79] hostfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 38/79] hpfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 39/79] hugetlbfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 40/79] isofs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 41/79] jffs2: " Jeff Layton
2023-06-21 14:45   ` [PATCH 42/79] jfs: " Jeff Layton
2023-06-21 17:47     ` Dave Kleikamp
2023-06-21 14:45   ` [PATCH 43/79] kernfs: " Jeff Layton
2023-06-21 15:30     ` Greg Kroah-Hartman
2023-06-21 14:45   ` [PATCH 44/79] minix: " Jeff Layton
2023-06-21 14:45   ` [PATCH 45/79] nfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 46/79] nfsd: " Jeff Layton
2023-06-21 17:36     ` Chuck Lever
2023-06-21 14:46   ` [PATCH 47/79] nilfs2: " Jeff Layton
2023-06-26 15:26     ` Ryusuke Konishi
2023-06-21 14:46   ` [PATCH 48/79] ntfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 49/79] ntfs3: " Jeff Layton
2023-06-21 14:46   ` [PATCH 50/79] ocfs2: " Jeff Layton
2023-06-21 14:46   ` [PATCH 51/79] omfs: " Jeff Layton
2023-06-23 12:12     ` Bob Copeland
2023-06-21 14:46   ` [PATCH 52/79] openpromfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 53/79] orangefs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 54/79] overlayfs: " Jeff Layton
2023-06-22  6:44     ` Amir Goldstein
2023-06-21 14:46   ` [PATCH 55/79] proc: " Jeff Layton
2023-06-30 22:13     ` Luis Chamberlain
2023-06-21 14:46   ` [PATCH 56/79] pstore: " Jeff Layton
2023-06-21 17:50     ` Kees Cook
2023-06-21 14:46   ` [PATCH 57/79] qnx4: " Jeff Layton
2023-06-23 14:26     ` Anders Larsen
2023-06-21 14:46   ` [PATCH 58/79] qnx6: " Jeff Layton
2023-06-21 14:46   ` [PATCH 59/79] ramfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 60/79] reiserfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 61/79] romfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 62/79] smb: " Jeff Layton
2023-06-21 17:45     ` Tom Talpey [this message]
2023-06-23  5:03     ` Sergey Senozhatsky
2023-06-21 14:46   ` [PATCH 63/79] squashfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 64/79] sysv: " Jeff Layton
2023-06-21 14:46   ` [PATCH 65/79] tracefs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 66/79] ubifs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 67/79] udf: " Jeff Layton
2023-06-21 14:46   ` [PATCH 68/79] ufs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 69/79] vboxsf: " Jeff Layton
2023-06-21 14:46   ` [PATCH 70/79] xfs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 71/79] zonefs: " Jeff Layton
2023-06-22  0:48     ` Damien Le Moal
2023-06-21 14:46   ` [PATCH 72/79] mqueue: " Jeff Layton
2023-06-21 14:46   ` [PATCH 73/79] bpf: " Jeff Layton
2023-06-21 14:46   ` [PATCH 74/79] shmem: " Jeff Layton
2023-06-21 14:46   ` [PATCH 75/79] rpc_pipefs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 76/79] apparmor: " Jeff Layton
2023-06-22  9:04     ` John Johansen
2023-06-21 14:46   ` [PATCH 77/79] security: " Jeff Layton
2023-06-23 14:15     ` Paul Moore
2023-06-21 14:46   ` [PATCH 78/79] selinux: " Jeff Layton
2023-06-23 14:17     ` Paul Moore
2023-06-21 16:34   ` [PATCH 02/79] spufs: " Jan Kara
2023-06-22  0:19   ` Jeremy Kerr
     [not found] ` <20230621152141.5961cf5f@gandalf.local.home>
     [not found]   ` <2a5a069572b46b59dd16fe8d54e549a9b5bbb6eb.camel@kernel.org>
2023-06-23 12:41     ` [PATCH 00/79] fs: new accessors for inode->i_ctime Christian Brauner
2023-06-30 22:11   ` Luis Chamberlain
     [not found] ` <20230621144507.55591-2-jlayton@kernel.org>
     [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
2023-06-22 10:14     ` [PATCH 01/79] fs: add ctime accessors infrastructure Jeff Layton
2023-06-30 22:12   ` Luis Chamberlain
2023-07-12 15:31   ` Randy Dunlap
2023-07-12 15:34     ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d32dab41-6d98-a45c-0238-e17c5a0b4d11@talpey.com \
    --to=tom@talpey.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=pc@manguebit.com \
    --cc=samba-technical@lists.samba.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®