[Virtio-fs] [PATCH v2] fuse: invalidate inode attr in writeback cache mode
Miklos Szeredi
miklos at szeredi.hu
Wed May 13 09:39:34 UTC 2020
On Tue, May 12, 2020 at 4:29 AM Eryu Guan <eguan at linux.alibaba.com> wrote:
>
> Under writeback mode, inode->i_blocks is not updated, making utils du
> read st.blocks as 0.
>
> For example, when using virtiofs (cache=always & nondax mode) with
> writeback_cache enabled, writing a new file and check its disk usage
> with du, du reports 0 usage.
>
> # uname -r
> 5.6.0-rc6+
> # mount -t virtiofs virtiofs /mnt/virtiofs
> # rm -f /mnt/virtiofs/testfile
>
> # create new file and do extend write
> # xfs_io -fc "pwrite 0 4k" /mnt/virtiofs/testfile
> wrote 4096/4096 bytes at offset 0
> 4 KiB, 1 ops; 0.0001 sec (28.103 MiB/sec and 7194.2446 ops/sec)
> # du -k /mnt/virtiofs/testfile
> 0 <==== disk usage is 0
> # stat -c %s,%b /mnt/virtiofs/testfile
> 4096,0 <==== i_size is correct, but st_blocks is 0
>
> Fix it by invalidating attr in fuse_flush(), so we get up-to-date attr
> from server on next getattr.
Thanks, applied.
I started thinking: why is fuse_flush() only writing out dirty pages
if fc->no_flush is false? It just doesn't make sense... But that's
an independent bug, and I'll do a separate patch for that.
Thanks,
Miklos
More information about the Virtio-fs
mailing list