summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-09-14 10:20:28 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-09-14 10:20:28 -0700
commit59826bc5a42a5e85dc21d4cdf3892f22dcda65f8 (patch)
tree1fee0589c6e3180513b4c07edac8ce90702fe4b8
parent01414b70cb6f7a5911b65de0cc97225061f60a59 (diff)
parentc60ae98c5aa64021751b38ab1313b19d620bf640 (diff)
Merge tag '9p-for-7.3-rc4' of https://github.com/martinetd/linux
Pull 9pfs fix from Dominique Martinet: "This is a single fix for a 9p/netfs regression that got in 7.1 (and was backported to 7.0) We need to rework how cached attributes, and in particular i_size, are handled in 9p more thoroughly but that will take more time and this appears to be enough for the most obvious problems" * tag '9p-for-7.3-rc4' of https://github.com/martinetd/linux: 9p: Fix v9fs_issue_write() to update i_size and remote_i_size
-rw-r--r--fs/9p/vfs_addr.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 1ac0b3dcc077..13cf87a5f90c 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -54,11 +54,37 @@ static void v9fs_begin_writeback(struct netfs_io_request *wreq)
static void v9fs_issue_write(struct netfs_io_subrequest *subreq)
{
struct p9_fid *fid = subreq->rreq->netfs_priv;
+ struct inode *inode = subreq->rreq->inode;
+ struct netfs_inode *ictx = netfs_inode(inode);
int err, len;
len = p9_client_write(fid, subreq->start, &subreq->io_iter, &err);
- if (len > 0)
+ if (len > 0) {
+ uoff_t end = subreq->start + len, i_size, remote, zp;
+ bool set = false;
+
+ spin_lock(&inode->i_lock);
+
+ /* We can read the sizes directly as we hold i_lock. */
+ i_size = inode->i_size;
+ remote = ictx->_remote_i_size;
+ zp = ictx->_zero_point;
+
+ if (end > i_size) {
+ i_size = end;
+ set = true;
+ }
+ if (end > remote) {
+ remote = end;
+ set = true;
+ }
+
+ if (set)
+ netfs_write_sizes(inode, i_size, remote, zp);
+ spin_unlock(&inode->i_lock);
+
__set_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
+ }
netfs_write_subrequest_terminated(subreq, len ?: err);
}