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 protected]>
> Signed-off-by: David Howells <[email protected]>
> Tested-by: Marc Dionne <[email protected]>
> cc: Eric Van Hensbergen <[email protected]>
> cc: Latchesar Ionkov <[email protected]>
> cc: Dominique Martinet <[email protected]>
With that being said, it seems to do the immediate job:
Acked-by: Dominique Martinet <[email protected]>
--
Dominique Martinet | Asmadeus
Dominique Martinet <[email protected]> wrote:
> Would it make sense to just always update netfs's ctx->remote_i_size in
> the various stat2inode calls instead?
Yeah, that's probably a good idea.
David
Dominique Martinet <[email protected]> wrote:
> Would it make sense to just always update netfs's ctx->remote_i_size in
> the various stat2inode calls instead?
Btw, v9fs_i_size_write() should be redundant. It should be sufficient to just
use i_size_write() as long as you use i_size_read().
David