On Wed, May 6, 2020 at 5:21 PM Eryu Guan <eguan@xxxxxxxxxxxxxxxxx> wrote: > > Under writeback mode, inode->i_blocks is not updated, making utils like > 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. Hmm... invalidating the attribute might also yield the wrong result as the server may not have received the WRITE request that modifies the underlying file. Invalidating attributes at the end of fuse_flush() definitely makes sense, though. If we wanted 100% correct behavior, we'd need to flush WRITE requests before each GETATTR request. That might be a performance bottleneck, though. So first I'd just try doing the invalidation from fuse_flush(). Thanks, Miklos