From: "email@example.com" <firstname.lastname@example.org> To: 'Vivek Goyal' <email@example.com> Cc: "'firstname.lastname@example.org'" <email@example.com>, "'firstname.lastname@example.org'" <email@example.com> Subject: RE: [Virtio-fs] [PATCH] virtiofsd: Fix data corruption with O_APPEND wirte in writeback mode Date: Thu, 31 Oct 2019 09:39:23 +0000 [thread overview] Message-ID: <OSBPR01MB3783739E4F9545DABEF3E230E5630@OSBPR01MB3783.jpnprd01.prod.outlook.com> (raw) In-Reply-To: <OSBPR01MB37833C9325AD3D9190108FAEE5610@OSBPR01MB3783.jpnprd01.prod.outlook.com> > > -----Original Message----- > > From: firstname.lastname@example.org > > [mailto:email@example.com] On Behalf Of > > firstname.lastname@example.org > > Sent: Friday, October 25, 2019 7:02 PM > > To: 'Vivek Goyal' <email@example.com> > > Cc: firstname.lastname@example.org; email@example.com > > Subject: Re: [Virtio-fs] [PATCH] virtiofsd: Fix data corruption with > > O_APPEND wirte in writeback mode > > > > > On Wed, Oct 23, 2019 at 04:07:52PM -0400, Vivek Goyal wrote: > > > > On Wed, Oct 23, 2019 at 09:25:23PM +0900, Misono Tomohiro wrote: > > > > > When writeback mode is enabled (-o writeback), O_APPEND handling > > > > > is done in kernel. Therefore virtiofsd clears O_APPEND flag when open. > > > > > Otherwise O_APPEND flag takes precedence over pwrite() and write > > > > > data may corrupt. > > > > > > > > > > Currently clearing O_APPEND flag is done in lo_open(), but we > > > > > also need the same operation in lo_create(). > > > > > > > > > So, factor out the flag > > > > > update operation in lo_open() to update_open_flags() and call it > > > > > in both lo_open() and lo_create(). > > > > > > > > > > This fixes the failure of xfstest generic/069 in writeback mode > > > > > (which tests O_APPEND write data integrity). > > > > > > > > > > > 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? Thanks, Misono
next prev parent reply other threads:[~2019-10-31 9:43 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-23 12:25 Misono Tomohiro 2019-10-23 20:07 ` [Virtio-fs] " Vivek Goyal 2019-10-24 15:02 ` Vivek Goyal 2019-10-25 10:02 ` misono.tomohiro 2019-10-29 10:07 ` misono.tomohiro 2019-10-31 9:39 ` misono.tomohiro [this message] 2019-10-31 15:47 ` Vivek Goyal 2019-10-31 15:47 ` Vivek Goyal 2019-11-01 8:08 ` Dr. David Alan Gilbert
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=OSBPR01MB3783739E4F9545DABEF3E230E5630@OSBPR01MB3783.jpnprd01.prod.outlook.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='RE: [Virtio-fs] [PATCH] virtiofsd: Fix data corruption with O_APPEND wirte in writeback mode' \ /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
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).