On Tue, Mar 27, 2012 at 10:34:47AM -0400, Christoph Hellwig wrote:
> We do not need the ilock for generic_write_checks and the i_size read,
> which are protected by i_mutex and/or iolock, so reduce the ilock
> critical section to just the call to xfs_zero_eof.
So.. I agree that it looks like the only thing we need to protect in
generic_write_checks is the i_size_read.
For buffered io i_size_write is done in generic_write_end, and protected
XFS_IOLOCK_EXCL in xfs_file_buffered_write.
For direct io i_size_write is done in generic_file_direct_write and also
protected by the iolock in xfs_file_dio_aio_write. It's not as clear here
whether that lock is taken exclusive at that time. However, this is handled in
xfs_file_aio_write_checks, where we go io exclusive for xfs_zero_eof. Maybe it
would be best for this to be done more explicitly with respect to the inode
size in xfs_file_dio_aio_write.
Just wanting to show why generic_write_checks is ok protected with just the