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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/IPbcYBuWt0zoYhOq06b7GqY5nAFAmqnvp4ACgkQq06b7GqY
 5nCy9A//exHLeO1m7x071zuNl8nEFKUyNALRqb0sXavk/KIHn8gAl1Ll8gB/ic20
 SOvXR+NhlLEzMFG5WJd0sCDNALhEPsNzxf2JLqvCtXTGQkC4Dh+rJzy4C0FDKW6E
 I0kC60XuPiX+ZzqseBLm4T0LAVTGp3RZCb9GF1xpV0uzkMvF4QuyRSNRMukL3A65
 7Zk2e9FVHnt6BhEpG7HIjtZLTr1tTtXvUQFMHhMSSQCAR5DMS5pNedmH4nFjdyhf
 cLFKnppYGY9QWW1jvv3BhfO00UilUJLIx6hLXwyin/79BH30OChcWj8brm6cewS0
 V90uTxN6/X5plzc7VBnXB9Pt4Tf6stahgRqdUsWs3rYwtYaONE2a3yww4aMW4aPR
 8nIkpAD5GydTCSS1PS/82Ul2RuQRiqn9RV7yaTFw4r7G+CWMu0RKPhsitPKVL+jK
 3YdoHsjXR/XpVb1V7UQbi7xEAsBe8lRad1Z91DDrmSTkpHY1BeR99XCj/x9RKptx
 qTyHGcnmrAWUcueoQ2Hlj3SR9prEhbgNBG3VdPR2BlOOkTQTcRbW3u9OesGNyg6v
 C8YXfPj6WMgp4m4pW2RVJByyeQybppxaCzNIbH3Ntzqg9tQeuOmDDPFZO58NeYPB
 78sU2ZNUl11TkAvwZxZXoLTDHP1w/zY5kfF18OvqH72jxPEtH/o=
 =CCZT
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2026-09-14 10:20:28 -07:00
commit 59826bc5a4

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);
}