From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, Jeff Layton <jlayton@redhat.com>
Subject: Re: [PATCH] xfs: rewrite the fdatasync optimization
Date: Wed, 14 Feb 2018 10:26:40 +1100 [thread overview]
Message-ID: <20180213232640.GG6778@dastard> (raw)
In-Reply-To: <20180213150402.GA15030@lst.de>
On Tue, Feb 13, 2018 at 04:04:02PM +0100, Christoph Hellwig wrote:
> On Fri, Feb 09, 2018 at 10:17:25AM +1100, Dave Chinner wrote:
> > > > I thought that NFS requires the iversion changes to be made stable
> > > > at the same time as the data changes they correspond to is made
> > > > stable? i.e. NFS requires us to stabilise the on disk iversion field
> > > > during fdatasync.
> > >
> > > Yes,
> >
> > So you're agreeing with me that if iversion is changed, then
> > fdatasync needs to force the log.
>
> No, not at all. fdatasync does simply not matter for NFS changetimes.
> NFS comes in through commit_inode_metadata, for which the fdatasync
> optimization is irrelevant.
Yes, for NFS server based IO.i
No, for local user IO to the local fs that is also exported via NFS.
> But even discounting NFS - anyone caring
> about timestamps persisting must use fsync and not fdatasync, in fact
> that is the whole point for fdatasyncs existence!
Yes, but timestamps are not the issue here - we know the behaviour
is correct. The issue here is the iversion change counter
semantics be w.r.t. fdatasync, and you haven't established a case
fdatasync being able to avoid it.
> > > new XFS_ILOG_VERSION flag is needed is to be able to check if
> > > an fdatasync needs to flush out an inode log item.
> >
> > If we don't change iversion because it's not been queried, then in
> > the current code then XFS_ILOG_CORE will not be set and so the inode
> > remains only timestamp dirty and does not get flushed by fdatasync.
> > If we change iversion, then XFS_ILOG_CORE gets set, and the next
> > fdatasync will correctly flush the inode log item.
>
> Yes, if we talk about ili_fields. Once we are deep down in the logging
> core XFS_ILOG_CORE of course gets set, see xfs_inode_item_format.
>
> > If we look at your code now, when we change iversion we'll set
> > XFS_ILOG_VERSION and that will now behave identically to the
> > timestamp code w.r.t. fdatasync. i.e. we will *never* flush pure
> > iversion/timestamp changes on fdatasync.
>
> And that is the correct behavior for fdatasync.
For *timestamps*, yes.
But iversion is a *data change notifier*, and hence it's directly
related to the data being stabilised during fdatasync.
e.g. In the case of a local write to an NFS exported filesystem, the
iversion needs to be made stable at the same time as the data via
fdatasync. That way if the server crashes after fdatasync, when it
comes back up all the NFS clients see that the data in that file
has changed via the recovered iversion change from the fdatasync.
If the iversion change is not written to the log during the
fdatasync, then none of the NFS clients will detect that the data
has actually changed after the server has recovered from the crash.
AIUI, this violates the semantics NFS requires from the iversion
field, and that means fdatasync needs to flush iversion changes.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-02-13 23:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 7:39 [PATCH] xfs: rewrite the fdatasync optimization Christoph Hellwig
2018-02-05 22:17 ` Dave Chinner
2018-02-06 7:23 ` Christoph Hellwig
2018-02-08 23:17 ` Dave Chinner
2018-02-13 15:04 ` Christoph Hellwig
2018-02-13 23:26 ` Dave Chinner [this message]
2018-02-14 15:53 ` Christoph Hellwig
2018-02-14 22:43 ` Dave Chinner
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=20180213232640.GG6778@dastard \
--to=david@fromorbit.com \
--cc=hch@lst.de \
--cc=jlayton@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/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).