David Howells wrote on Wed, Feb 18, 2026 at 01:41:25PM +0000: > > A better way is probably, in v9fs_stat2inode() and v9fs_stat2inode_dotl(), if > > the inode isn't new, compare the values for stat->mtime to inode->i_mtime and > > stat->length to v9inode->netfs.remote_i_size and if they differ mark the inode > > as being remotely modified, invalidate the pagecache and reset inode->i_size. > > > > If stat->mtime == inode->i_mtime and stat->length == > > v9inode->netfs.remote_i_size, then don't alter inode->i_size. > > Also, you'd need to update remote_i_size upon successful completion of a write > RPC call to increase it up to the end of the write. I pointed out a couple of problems with that on IRC, so replying here for everyone: - for msize, it's set by the server (using server clock) anywhere between our write request and the reply, so we can't predict it (we could, however, remember that there's been an io or not, and if mtime changes when there was no io we could use it to invalidate our cache or something) - for size, we'd need to flush (like the v1 of this patch) -- apparently this is fs specific but it might make sense to flush unless AT_STATX_DONT_SYNC is specified similarly to what nfs_getattr() does This part is just me thinking out loud (not discussed properly), but I kind of like what nfs does in fs/nfs/inode.c nfs_wcc_update_inode() and nfs_check_inode_attributes(): if there are IOs in progress, they ignore the server i_size: if (fattr->valid & NFS_ATTR_FATTR_SIZE) { cur_size = i_size_read(inode); new_isize = nfs_size_to_loff_t(fattr->size); if (cur_size != new_isize) invalid |= NFS_INO_INVALID_SIZE; } If cache is used I agree with Christian that the client can be considered correct, but I don't like the idea that we'd never catch a server update that happens much later, but that might need work... Right now I'm a bit torn between "it'd be good to fix this sooner than later" (and want to take this as a stop-gap) and "it's scary to never notice size changes I'm sure it'll break some CI again", so since David said he'd look some more I'm thinking of giving him a bit more time first but if there's no clear solution emerging in a week or two let's first get this v2 in as a first step, then we can do better as a second iteration... I've attached irc logs for today, if anyone wants to read up -- Dominique