From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs <linux-xfs@vger.kernel.org>
Subject: Re: [RFC PATCH] xfs: fix cow_seq locking behavior
Date: Mon, 30 Jul 2018 09:22:52 -0700 [thread overview]
Message-ID: <20180730162252.GA19254@infradead.org> (raw)
In-Reply-To: <20180730155207.GV30972@magnolia>
On Mon, Jul 30, 2018 at 08:52:07AM -0700, Darrick J. Wong wrote:
> /*
> * COW fork blocks can overlap data fork blocks even if the blocks
> * aren't shared. COW I/O always takes precedent, so we must always
> * check for overlap on reflink inodes unless the mapping is already a
> * COW one.
> *
> * It's safe to check the COW fork if_seq here without the ILOCK because
> * we've indirectly protected against concurrent updates: writeback has
> * the page locked, which prevents concurrent invalidations by reflink
> * and directio and prevents concurrent buffered writes to the same
> * page. Concurrent changes to other parts of the COW fork will drop
> * the i_lock on their way out, which provides the necessary memory
> * barrier to ensure that we see the updated if_seq.
> */
>
> I'm not actually sure about the last sentence anymore -- that's what I
> was thinking the first time I looked at this patch, before Dave spoke
> up.
Yeah, that last sentence looks odd. I'd replace it with:
Changes to if_seq always happen under i_lock, which protects against
concurrent updates and provides a memory barrier on the way out that
ensures that we always see the current value.
prev parent reply other threads:[~2018-07-30 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 5:55 [RFC PATCH] xfs: fix cow_seq locking behavior Darrick J. Wong
2018-07-30 8:14 ` Christoph Hellwig
2018-07-30 15:52 ` Darrick J. Wong
2018-07-30 16:22 ` 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=20180730162252.GA19254@infradead.org \
--to=hch@infradead.org \
--cc=darrick.wong@oracle.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).