From: Christoph Hellwig <hch@lst.de>
To: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@lst.de>,
linux-xfs@vger.kernel.org, Jeff Layton <jlayton@redhat.com>
Subject: Re: [PATCH] xfs: rewrite the fdatasync optimization
Date: Tue, 13 Feb 2018 16:04:02 +0100 [thread overview]
Message-ID: <20180213150402.GA15030@lst.de> (raw)
In-Reply-To: <20180208231725.GH20266@dastard>
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. 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!
> > 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.
> That's not the behaviour NFS requires - we'll stabilise data but we
> will not stabilise the iversion change that goes along with that
> data change. Hence if we crash after fdatasync, there'll be new data
> on disk and an old iversion....
>
> So, AFAICT, this patch does change behviour and it breaks the
> iversion semantics that the NFS server requires for data
> modification.
We still log exactly the same transaction to the log with this change.
The only difference is that a fdatasync will only force out the latest
transaction that has some non-timestamp, non-version change instead of
just the latests non-timestamp change. For anyone using fsync-like
semantics like NFS nothing changes at all.
next prev parent reply other threads:[~2018-02-13 15:04 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 [this message]
2018-02-13 23:26 ` Dave Chinner
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=20180213150402.GA15030@lst.de \
--to=hch@lst.de \
--cc=david@fromorbit.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.