Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Frank Sorenson <sorenson@redhat.com>
To: linux-cifs@vger.kernel.org, pc@manguebit.org, stfrench@microsoft.com
Subject: [PATCH 0/3] cifs: follow-on fixes and cleanup after fscache_resize_cookie() consolidation
Date: Tue, 28 Jul 2026 16:14:35 -0500	[thread overview]
Message-ID: <20260728211438.3859107-1-sorenson@redhat.com> (raw)

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


             reply	other threads:[~2026-07-28 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 21:14 Frank Sorenson [this message]
2026-07-28 21:14 ` [PATCH 1/3] cifs: use cifs_invalidate_cache() in cifs_do_truncate() for O_TRUNC Frank Sorenson
2026-07-29  4:20   ` Huiwen He
2026-07-29 13:52     ` Frank Sorenson
2026-07-28 21:14 ` [PATCH 2/3] cifs: remove redundant size-update block in cifs_remap_file_range() Frank Sorenson
2026-07-28 21:14 ` [PATCH 3/3] cifs: remove dead size-update blocks in cifs_setattr_unix/nounix Frank Sorenson

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=20260728211438.3859107-1-sorenson@redhat.com \
    --to=sorenson@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=stfrench@microsoft.com \
    /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