linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Eryu Guan <eguan@linux.alibaba.com>
Cc: linux-fsdevel@vger.kernel.org,
	virtio-fs-list <virtio-fs@redhat.com>,
	Liu Bo <bo.liu@linux.alibaba.com>
Subject: Re: [PATCH v2] fuse: invalidate inode attr in writeback cache mode
Date: Wed, 13 May 2020 11:39:34 +0200	[thread overview]
Message-ID: <CAJfpegsVN-DuruF8E-hq2dxhsEciPOA+pBUdZSu6VHb3VAiTRw@mail.gmail.com> (raw)
In-Reply-To: <20200512022904.75689-1-eguan@linux.alibaba.com>

On Tue, May 12, 2020 at 4:29 AM Eryu Guan <eguan@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

      reply	other threads:[~2020-05-13  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 15:20 [PATCH RFC] fuse: invalidate inode attr in writeback cache mode Eryu Guan
2020-05-11 13:06 ` Miklos Szeredi
2020-05-12  2:06   ` Eryu Guan
2020-05-12  2:29 ` [PATCH v2] " Eryu Guan
2020-05-13  9:39   ` Miklos Szeredi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJfpegsVN-DuruF8E-hq2dxhsEciPOA+pBUdZSu6VHb3VAiTRw@mail.gmail.com \
    --to=miklos@szeredi.hu \
    --cc=bo.liu@linux.alibaba.com \
    --cc=eguan@linux.alibaba.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=virtio-fs@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).