From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>,
Christoph Hellwig <hch@infradead.org>,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2] xfs: _{attr,data}_map_shared should take ILOCK_EXCL until iread_extents is completely done
Date: Wed, 12 Apr 2023 05:02:44 -0700 [thread overview]
Message-ID: <ZDad5BU5pViaOMwL@infradead.org> (raw)
In-Reply-To: <20230411184934.GK360889@frogsfrogsfrogs>
On Tue, Apr 11, 2023 at 11:49:34AM -0700, Darrick J. Wong wrote:
> @@ -226,10 +226,15 @@ xfs_iformat_data_fork(
>
> /*
> * Initialize the extent count early, as the per-format routines may
> - * depend on it.
> + * depend on it. Use release semantics to set needextents /after/ we
> + * set the format. This ensures that we can use acquire semantics on
> + * needextents in xfs_need_iread_extents() and be guaranteed to see a
> + * valid format value after that load.
> */
> ip->i_df.if_format = dip->di_format;
> ip->i_df.if_nextents = xfs_dfork_data_extents(dip);
> + smp_store_release(&ip->i_df.if_needextents,
> + ip->i_df.if_format == XFS_DINODE_FMT_BTREE ? 1 : 0);
ip->i_df is memset to zero a little earlier (same for the attr fork),
this only needs to be:
if (ip->i_df.if_format == XFS_DINODE_FMT_BTREE)
smp_store_release(&ip->i_df.if_needextents, 1);
prev parent reply other threads:[~2023-04-12 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 18:49 [PATCH v2] xfs: _{attr,data}_map_shared should take ILOCK_EXCL until iread_extents is completely done Darrick J. Wong
2023-04-11 22:53 ` [PATCH v2] xfsprogs: " Darrick J. Wong
2023-04-11 23:57 ` Dave Chinner
2023-04-11 23:54 ` [PATCH v2] xfs: " Dave Chinner
2023-04-12 12:02 ` 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=ZDad5BU5pViaOMwL@infradead.org \
--to=hch@infradead.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--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