Re: [PATCH] xfs: fix data races in inode->i_*time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux