Re: [PATCH] xfs: fix eofblocks race with file extending async dio writes

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

 



On Thu, Jan 12, 2017 at 05:56:03AM -0800, Christoph Hellwig wrote:
> >  		if (need_iolock) {
> >  			if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL))
> >  				return -EAGAIN;
> >  		}
> > +		inode_dio_wait(VFS_I(ip));
> 
> inode_dio_wait generally is only safe to call with i_rwsem held
> exclsuively, so if we'd need the call for the !need_iolock this would
> be broken.  Fortunately we don't even need the call in that case, so
> this should be safe.  I'd still prefer to move the inode_dio_wait call
> into the need_iolock block to make that clear, though.

!need_iolock means the iolock is already held. I guess the name is kind
of confusing. !need_iolock doesn't mean that the lock is unnecessary, it
just means that we're calling from a context where it's already held.
See the xfs_icache_free_eofblocks() call from
xfs_file_buffered_aio_write() for reference.

I suppose I could add an ASSERT(xfs_isilocked()) after that block to
better document that..

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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