Skip to content

Commit ab611f6

Browse files
committed
smb: convert to ctime accessor functions
jira LE-4159 Rebuild_History Non-Buildable kernel-5.14.0-570.41.1.el9_6 commit-author Jeff Layton <[email protected]> commit 9448765 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-570.41.1.el9_6/94487653.failed In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Acked-by: Tom Talpey <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Acked-by: Steve French <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Brauner <[email protected]> (cherry picked from commit 9448765) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # fs/smb/server/smb2pdu.c
1 parent 56cf9f2 commit ab611f6

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
smb: convert to ctime accessor functions
2+
3+
jira LE-4159
4+
Rebuild_History Non-Buildable kernel-5.14.0-570.41.1.el9_6
5+
commit-author Jeff Layton <[email protected]>
6+
commit 9448765397b6e6522dff485f4b480b7ee020a536
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-5.14.0-570.41.1.el9_6/94487653.failed
10+
11+
In later patches, we're going to change how the inode's ctime field is
12+
used. Switch to using accessor functions instead of raw accesses of
13+
inode->i_ctime.
14+
15+
Acked-by: Tom Talpey <[email protected]>
16+
Reviewed-by: Sergey Senozhatsky <[email protected]>
17+
Signed-off-by: Jeff Layton <[email protected]>
18+
Acked-by: Steve French <[email protected]>
19+
Message-Id: <[email protected]>
20+
Signed-off-by: Christian Brauner <[email protected]>
21+
(cherry picked from commit 9448765397b6e6522dff485f4b480b7ee020a536)
22+
Signed-off-by: Jonathan Maple <[email protected]>
23+
24+
# Conflicts:
25+
# fs/smb/server/smb2pdu.c
26+
* Unmerged path fs/smb/server/smb2pdu.c
27+
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
28+
index 254347d16db6..21a887f3a36f 100644
29+
--- a/fs/smb/client/file.c
30+
+++ b/fs/smb/client/file.c
31+
@@ -1066,7 +1066,7 @@ int cifs_close(struct inode *inode, struct file *file)
32+
if ((cfile->status_file_deleted == false) &&
33+
(smb2_can_defer_close(inode, dclose))) {
34+
if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {
35+
- inode->i_ctime = inode->i_mtime = current_time(inode);
36+
+ inode->i_mtime = inode_set_ctime_current(inode);
37+
}
38+
spin_lock(&cinode->deferred_lock);
39+
cifs_add_deferred_close(cfile, dclose);
40+
@@ -2634,7 +2634,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
41+
write_data, to - from, &offset);
42+
cifsFileInfo_put(open_file);
43+
/* Does mm or vfs already set times? */
44+
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
45+
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
46+
if ((bytes_written > 0) && (offset))
47+
rc = 0;
48+
else if (bytes_written < 0)
49+
diff --git a/fs/smb/client/fscache.h b/fs/smb/client/fscache.h
50+
index c691b98b442a..82e7f7a15491 100644
51+
--- a/fs/smb/client/fscache.h
52+
+++ b/fs/smb/client/fscache.h
53+
@@ -50,12 +50,13 @@ void cifs_fscache_fill_coherency(struct inode *inode,
54+
struct cifs_fscache_inode_coherency_data *cd)
55+
{
56+
struct cifsInodeInfo *cifsi = CIFS_I(inode);
57+
+ struct timespec64 ctime = inode_get_ctime(inode);
58+
59+
memset(cd, 0, sizeof(*cd));
60+
cd->last_write_time_sec = cpu_to_le64(cifsi->netfs.inode.i_mtime.tv_sec);
61+
cd->last_write_time_nsec = cpu_to_le32(cifsi->netfs.inode.i_mtime.tv_nsec);
62+
- cd->last_change_time_sec = cpu_to_le64(cifsi->netfs.inode.i_ctime.tv_sec);
63+
- cd->last_change_time_nsec = cpu_to_le32(cifsi->netfs.inode.i_ctime.tv_nsec);
64+
+ cd->last_change_time_sec = cpu_to_le64(ctime.tv_sec);
65+
+ cd->last_change_time_nsec = cpu_to_le32(ctime.tv_nsec);
66+
}
67+
68+
69+
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
70+
index 83d1b0b9f5c1..2c38d3214c78 100644
71+
--- a/fs/smb/client/inode.c
72+
+++ b/fs/smb/client/inode.c
73+
@@ -170,7 +170,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr,
74+
else
75+
inode->i_atime = fattr->cf_atime;
76+
inode->i_mtime = fattr->cf_mtime;
77+
- inode->i_ctime = fattr->cf_ctime;
78+
+ inode_set_ctime_to_ts(inode, fattr->cf_ctime);
79+
inode->i_rdev = fattr->cf_rdev;
80+
cifs_nlink_fattr_to_inode(inode, fattr);
81+
inode->i_uid = fattr->cf_uid;
82+
@@ -2004,9 +2004,9 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
83+
cifs_inode = CIFS_I(inode);
84+
cifs_inode->time = 0; /* will force revalidate to get info
85+
when needed */
86+
- inode->i_ctime = current_time(inode);
87+
+ inode_set_ctime_current(inode);
88+
}
89+
- dir->i_ctime = dir->i_mtime = current_time(dir);
90+
+ dir->i_mtime = inode_set_ctime_current(dir);
91+
cifs_inode = CIFS_I(dir);
92+
CIFS_I(dir)->time = 0; /* force revalidate of dir as well */
93+
unlink_out:
94+
@@ -2322,8 +2322,8 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
95+
*/
96+
cifsInode->time = 0;
97+
98+
- d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime =
99+
- current_time(inode);
100+
+ inode_set_ctime_current(d_inode(direntry));
101+
+ inode->i_mtime = inode_set_ctime_current(inode);
102+
103+
rmdir_exit:
104+
free_dentry_path(page);
105+
@@ -2537,8 +2537,8 @@ cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir,
106+
/* force revalidate to go get info when needed */
107+
CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0;
108+
109+
- source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime =
110+
- target_dir->i_mtime = current_time(source_dir);
111+
+ source_dir->i_mtime = target_dir->i_mtime = inode_set_ctime_to_ts(source_dir,
112+
+ inode_set_ctime_current(target_dir));
113+
114+
cifs_rename_exit:
115+
kfree(info_buf_source);
116+
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
117+
index ecd0b5c79c22..07283c98c575 100644
118+
--- a/fs/smb/client/smb2ops.c
119+
+++ b/fs/smb/client/smb2ops.c
120+
@@ -1443,7 +1443,8 @@ smb2_close_getattr(const unsigned int xid, struct cifs_tcon *tcon,
121+
if (file_inf.LastWriteTime)
122+
inode->i_mtime = cifs_NTtimeToUnix(file_inf.LastWriteTime);
123+
if (file_inf.ChangeTime)
124+
- inode->i_ctime = cifs_NTtimeToUnix(file_inf.ChangeTime);
125+
+ inode_set_ctime_to_ts(inode,
126+
+ cifs_NTtimeToUnix(file_inf.ChangeTime));
127+
if (file_inf.LastAccessTime)
128+
inode->i_atime = cifs_NTtimeToUnix(file_inf.LastAccessTime);
129+
130+
* Unmerged path fs/smb/server/smb2pdu.c

0 commit comments

Comments
 (0)