cifs: fix missing fscache_resize_cookie() calls in size-changing paths
Subsystems (3)
PATCH 1/1 cifs: fix missing fscache_resize_cookie() calls in size-changing paths
Several code paths that update the VFS inode size via netfs_resize_file() and cifs_setsize() omit the corresponding fscache_resize_cookie() call, leaving the fscache cookie out of sync with the actual file size:
- cifs_do_truncate() in file.c: truncates to zero on O_TRUNC open
- smb2_duplicate_extents() in smb2ops.c: file clone extending EOF
- smb3_simple_falloc() in smb2ops.c: two branches that extend EOF via write-range and SMB2_set_eof respectively
Add the missing fscache_resize_cookie() calls immediately after cifs_setsize() in each of these paths, consistent with the pattern used in the existing smb3_zero_range() and smb3_collapse_range() paths.
Fixes 70431bfd825d ("cifs: Support fscache indexing rewrite")
Fixes 93a43155127f ("cifs: Fix missing set of remote_i_size")
Fixes 110fee6b9bb5 ("smb: client: fix missing timestamp updates with O_TRUNC")
Fixes 7a06d3b816d7 ("smb/client: emulate small EOF-extending mode 0 fallocate ranges")
Cc David Howells <[email protected]>
Cc Paulo Alcantara <[email protected]>
Cc Huiwen He <[email protected]>
Signed-off-by Frank Sorenson <[email protected]>
--- fs/smb/client/file.c | 1 + fs/smb/client/smb2ops.c | 3 +++ 2 files changed, 4 insertions(+)
fs/smb/client/file.c +1 -0
@@ -1016,6 +1016,7 @@ static int cifs_do_truncate(const unsigned int xid, struct dentry *dentry)if (!rc) {netfs_resize_file (&cinode->netfs,0 , true);cifs_setsize (inode,0 ); +fscache_resize_cookie (cifs_inode_cookie (inode),0 ); } }if (cfile)
fs/smb/client/smb2ops.c +3 -0
@@ -2224,6 +2224,7 @@ smb2_duplicate_extents(const unsigned int xid, goto duplicate_extents_out;netfs_resize_file (netfs_inode (inode), dest_off + len, true);cifs_setsize (inode, dest_off + len); +fscache_resize_cookie (cifs_inode_cookie (inode), dest_off + len); } rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, trgtfile->fid.volatile_fid,
@@ -3778,6 +3779,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, new_eof = off + len;netfs_resize_file (&cifsi->netfs, new_eof, true);cifs_setsize (inode, new_eof); +fscache_resize_cookie (cifs_inode_cookie (inode), new_eof); qrc = SMB2_query_info(xid, tcon, cfile->fid.persistent_fid,
@@ -3827,6 +3829,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,netfs_resize_file (&cifsi->netfs, new_eof, true);cifs_setsize (inode, new_eof); +fscache_resize_cookie (cifs_inode_cookie (inode), new_eof); qrc = SMB2_query_info(xid, tcon, cfile->fid.persistent_fid,
Signature · 1 line
2.55.0