stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Brian Foster <bfoster@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Amir Goldstein <amir73il@gmail.com>,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Josef Bacik <jbacik@fb.com>,
	"stable [v4.9]" <stable@vger.kernel.org>
Subject: Re: [PATCH v2] xfs: fix incorrect log_flushed on fsync
Date: Wed, 6 Sep 2017 13:41:16 +0200	[thread overview]
Message-ID: <20170906114116.GA25884@lst.de> (raw)
In-Reply-To: <20170905153439.GB48515@bfoster.bfoster>

On Tue, Sep 05, 2017 at 11:34:39AM -0400, Brian Foster wrote:
> In xfs_log_force_lsn(), the iclog has to be ACTIVE. We switch it to
> WANT_SYNC, bump the refcnt and call release_iclog(). The latter may or
> may not do anything depending on the refcount. We set log_flushed
> immediately after the release before we know whether an xlog_sync() has
> actually occurred (is that your concern?). If XFS_LOG_SYNC is set, we
> wait on the iclog before _force_lsn() returns, which means the log
> buffer I/O has to have completed before we return either way. If the
> iclog is still WANT_SYNC, the release didn't do anything, but we wait on
> ic_force_wait which is triggered during I/O completion handling. If the
> iclog is already DIRTY/ACTIVE, then the I/O has already submitted and
> completed.
> 
> fsync looks like the only the user of log_flushed and it also uses
> XFS_LOG_SYNC. ISTM that the code is probably still bogus in principle,
> but in practice the fsync code may be safe. Thoughts? Am I missing
> something else?

Yes, I think you're right - the extra XFS_LOG_SYNC code papers over
the issue.  But given that the log_flushed indicator makes very
little sene without XFS_LOG_SYNC it should be ok.

      reply	other threads:[~2017-09-06 11:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 15:39 [PATCH v2] xfs: fix incorrect log_flushed on fsync Amir Goldstein
2017-09-02 13:19 ` Brian Foster
2017-09-02 15:47   ` Amir Goldstein
2017-09-05 14:40     ` Brian Foster
2017-09-05 14:54       ` Christoph Hellwig
2017-09-05 15:34         ` Brian Foster
2017-09-06 11:41           ` Christoph Hellwig [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=20170906114116.GA25884@lst.de \
    --to=hch@lst.de \
    --cc=amir73il@gmail.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=jbacik@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable@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).