From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Qian Cai <cai@lca.pw>,
elver@google.com, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: fix data races in inode->i_*time
Date: Tue, 25 Feb 2020 12:46:32 -0800 [thread overview]
Message-ID: <20200225204632.GA6191@infradead.org> (raw)
In-Reply-To: <20200225202829.GV6740@magnolia>
On Tue, Feb 25, 2020 at 12:28:29PM -0800, Darrick J. Wong wrote:
> > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> > index 81f2f93caec0..2d5ca13ee9da 100644
> > --- a/fs/xfs/xfs_iops.c
> > +++ b/fs/xfs/xfs_iops.c
> > @@ -547,9 +547,9 @@
> > stat->uid = inode->i_uid;
> > stat->gid = inode->i_gid;
> > stat->ino = ip->i_ino;
> > - stat->atime = inode->i_atime;
> > - stat->mtime = inode->i_mtime;
> > - stat->ctime = inode->i_ctime;
> > + stat->atime = READ_ONCE(inode->i_atime);
> > + stat->mtime = READ_ONCE(inode->i_mtime);
> > + stat->ctime = READ_ONCE(inode->i_ctime);
>
> Seeing as one is supposed to take ILOCK_SHARED before reading inode core
> information, why don't we do that here? Is there some huge performance
> benefit to be realized from READ_ONCE vs. waiting for the lock that
> protects all the writes from each other?
Yes, I don't see how READ_ONCE works on a structure.
I think you should look into fixing this race in generic_fillattr
first, and we then piggy back on that fix in XFS once it has all been
sorted out.
prev parent reply other threads:[~2020-02-25 20:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 20:09 [PATCH] xfs: fix data races in inode->i_*time Qian Cai
2020-02-25 20:27 ` Marco Elver
2020-02-25 20:28 ` Darrick J. Wong
2020-02-25 20:46 ` 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=20200225204632.GA6191@infradead.org \
--to=hch@infradead.org \
--cc=cai@lca.pw \
--cc=darrick.wong@oracle.com \
--cc=elver@google.com \
--cc=linux-kernel@vger.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