Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] cifs: call pagecache_isize_extended() in cifs_setsize() when extending
@ 2026-08-20 21:13 Frank Sorenson
  2026-08-21  0:00 ` Namjae Jeon
  2026-08-21 18:10 ` Paulo Alcantara
  0 siblings, 2 replies; 3+ messages in thread
From: Frank Sorenson @ 2026-08-20 21:13 UTC (permalink / raw)
  To: linux-cifs; +Cc: pc, linkinjeon, stable, David Howells

cifs_setsize() calls truncate_pagecache() but skips
pagecache_isize_extended() on extension.  truncate_setsize() shows
the correct pattern:

  i_size_write(inode, newsize);
  if (newsize > oldsize)
      pagecache_isize_extended(inode, oldsize, newsize);
  truncate_pagecache(inode, newsize);

pagecache_isize_extended() zeroes the tail of the page straddling old
EOF.  Without it, dirty bytes in that region can be written back to
the server, exposing stale data in the newly extended range.

Cc: stable@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
 fs/smb/client/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index d459b6f602ca..a5aa1ae23c5f 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -3059,6 +3059,8 @@ void cifs_setsize(struct inode *inode, loff_t offset)
 		inode->i_blocks = blocks;
 	spin_unlock(&inode->i_lock);
 	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
+	if (offset > old_size)
+		pagecache_isize_extended(inode, old_size, offset);
 	truncate_pagecache(inode, offset);
 	netfs_wait_for_outstanding_io(inode);
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-21 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 21:13 [PATCH] cifs: call pagecache_isize_extended() in cifs_setsize() when extending Frank Sorenson
2026-08-21  0:00 ` Namjae Jeon
2026-08-21 18:10 ` Paulo Alcantara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox