[Virtio-fs] [PATCH] virtiofsd: Fix data corruption with O_APPEND wirte in writeback mode
Vivek Goyal
vgoyal at redhat.com
Thu Oct 31 15:47:10 UTC 2019
On Thu, Oct 31, 2019 at 09:39:23AM +0000, misono.tomohiro at fujitsu.com wrote:
[..]
> > > > Hi Misono,
> > > >
> > > > Have you tried running pjdfstests. Looks like with the patch applied
> > > > I see following tests failing which were passing without the patch.
> > > > Can you please have a look. I ran daemon with options "-o
> > > cache=always -o writeback"
> >
> > I see these errors in both with and without this patch but not always.
> > Do you always see the failure?
> >
> > I use:
> > Kernel: Fuse's for-next branch
> > Qemu: virtio-fs-dev branch
> > backend: XFS (relatime)
> >
> > These tests fail because a/c/m time is not updated as expected.
> > So it seems this is related to the failure of xfstest generic/003.
> > I will look into the problem more.
> >
>
> Hi,
>
> So I fugured out the problem.
> The failure occurs when guest clock is earlier than host clock in writeback mode.
>
> The failure case checks:
> 1. get current c/time of file
> 2. sleep 1 second
> 3. modify file's metadata/data
> 4. check if c/mtime is updated
>
> And the tests fail because:
> 1. when file is opened, guest inode's time is initialized by host's inode information
> 2. In writeback mode, guest clock is used for c/mtime update
> 3. if guest clock is earlier than host clock, c/mtime could be updated
> earlier than current inode time.
>
> I can reproduce the problem reliably by deliberately setting guest clock earlier
> than host clock. I'm not sure if virtiofs is to be blmaed in this case, but should
> we not update c/mtime in guest if it is earlier then current c/mtime?
>
> Anyway, I believe this O_APPEND fix patch is irrelevant to the problem,
> could you please check it again?
Hi Misono,
Thanks for looking into it. I agree that a/c/m time updates with -o writeback
is probably a different issue and not related to your patch. So I am fine
with your patch.
Thanks
Vivek
More information about the Virtio-fs
mailing list