[PATCH 0/3] cifs: follow-on fixes and cleanup after fscache_resize_cookie() consolidation

Frank Sorenson <[email protected]> Tue, 28 Jul 2026 16:14:35 -0500
Newsgroups org.kernel.vger.linux-cifs
Message-ID <[email protected]>
After commit fa724e235cfd ("cifs: add fscache_resize_cookie() to
cifs_setsize()") consolidated fscache cookie resizing into cifs_setsize(),
two paths needed follow-on fixes and two dead-code blocks became removable.

Patch 1 fixes cifs_do_truncate() (O_TRUNC via cifs_open()).  The fscache
cookie is still quiescent at that point--fscache_use_cookie() is called
later in the same function--so fscache_begin_operation() returns failure
and fscache_resize_cookie() is a null operation.  The correct fix is
cifs_invalidate_cache(), which works on quiescent cookies: it
unconditionally increments inval_counter and sets
FSCACHE_COOKIE_NO_DATA_TO_READ, preventing stale cached data from being
served once the cookie is later activated.

Patches 2 and 3 remove dead code.  Patch 2 removes a caller-side
truncate_setsize() + fscache_resize_cookie() block from
cifs_remap_file_range() that became redundant once smb2_duplicate_extents()
started performing the full size update via cifs_setsize() under the
i_rwsem held by lock_two_nondirectories().  Patch 3 removes equivalent
dead blocks from cifs_setattr_unix() and cifs_setattr_nounix(): since
cifs_file_set_size() calls cifs_setsize() on success, i_size always equals
attrs->ia_size on the success path, making the subsequent size-inequality
blocks unreachable.

Frank Sorenson (3):
  cifs: use cifs_invalidate_cache() in cifs_do_truncate() for O_TRUNC
  cifs: remove redundant size-update block in cifs_remap_file_range()
  cifs: remove dead size-update blocks in cifs_setattr_unix/nounix

 fs/smb/client/cifsfs.c |  6 +-----
 fs/smb/client/file.c   |  1 +
 fs/smb/client/inode.c  | 14 --------------
 3 files changed, 2 insertions(+), 19 deletions(-)

-- 
2.55.0