Subject: Re: [PATCH] 9p: Fix initialisation of netfs_inode for 9p

From: Dominique Martinet <[email-masked]>
Date: Wed, 3 Jan 2024 22:10:14 +0900

David Howells wrote on Tue, Jan 02, 2024 at 09:49:39PM +0000:
> This needs a fix that I would fold in.  Somehow it gets through xfstests
> without it, but it seems problems can be caused with executables.

Looking at a file without that patch we seem to be reading just zeroes
off pre-existing files; I'm surprised xfstest doesn't have a write
something/umount/mount/check content is identical test...

(You're probably aware of this, but note for others this breaks with the
rest of the patch series even if the big 9p patch isn't applied -- this
is the main reason I'd rather just get the patch in this cycle, as the
new patches got more tests with the full series than with the 9p writes
patch dropped.)

> 9p: Fix initialisation of netfs_inode for 9p
> 
> The 9p filesystem is calling netfs_inode_init() in v9fs_init_inode() -
> before the struct inode fields have been initialised from the obtained file
> stats (ie. after v9fs_stat2inode*() has been called), but netfslib wants to
> set a couple of its fields from i_size.

Would it make sense to just always update netfs's ctx->remote_i_size in
the various stat2inode calls instead?
We don't have any cache coherency so if a file changes beneath us
through an edit on the server (or through another client) hell will
break loose anyway, but stat would update the inode's i_size so it'll
likely be weird that the remote_i_size doesn't get updated.

> Reported-by: Marc Dionne <[email-masked]>
> Signed-off-by: David Howells <[email-masked]>
> Tested-by: Marc Dionne <[email-masked]>
> cc: Eric Van Hensbergen <[email-masked]>
> cc: Latchesar Ionkov <[email-masked]>
> cc: Dominique Martinet <[email-masked]>

With that being said, it seems to do the immediate job:
Acked-by: Dominique Martinet <[email-masked]>

-- 
Dominique Martinet | Asmadeus