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
This commit is contained in:
Linus Torvalds
2026-09-14 10:20:28 -07:00
+27 -1
View File
@@ -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);
}