your patch "mm: Remove false WARN_ON from pagecache_isize_extended()"
Jan,
having run into that warning too, I looked into it a little, and now having found that patch am pretty uncertain: Both truncate_setsize() and pagecache_isize_extended() document that they want to be called with i_mutex held, so removing the WARN_ON() alone seems either incomplete or wrong. What I found to work without violating this documented requirement is the patch below.
Jan
fs/xfs/xfs_file.c +2 -2
@@ -797,7 +797,7 @@ xfs_file_fallocate( FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))return -EOPNOTSUPP ; -xfs_ilock (ip,XFS_IOLOCK_EXCL ); +xfs_rw_ilock (ip,XFS_IOLOCK_EXCL );if (mode &FALLOC_FL_PUNCH_HOLE ) { error =xfs_free_file_space (ip, offset, len);if (error)
@@ -877,7 +877,7 @@ xfs_file_fallocate( } out_unlock: -xfs_iunlock (ip,XFS_IOLOCK_EXCL ); +xfs_rw_iunlock (ip,XFS_IOLOCK_EXCL );return error; }
Quoted 8 lines · Jan Beulich
Jan,
having run into that warning too, I looked into it a little, and now having found that patch am pretty uncertain: Both
truncate_setsize()andpagecache_isize_extended()document that they want to be called withi_mutexheld, so removing theWARN_ON()alone seems either incomplete or wrong. What I found to work without violating this documented requirement is the patch below.
Or, just perhaps, the comments are wrong....
Some filesystems have stronger, more robust internal serialisation than the VFS provides with i_mutex....
fs/xfs/xfs_file.c xfs_file_fallocate( · line 803
Quoted 11 lines
fs/xfs/xfs_file.c +1
-1@@ -797,7 +797,7 @@ xfs_file_fallocate( FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))return -EOPNOTSUPP ; -xfs_ilock (ip,XFS_IOLOCK_EXCL ); +xfs_rw_ilock (ip,XFS_IOLOCK_EXCL );if (mode &FALLOC_FL_PUNCH_HOLE ) { error =xfs_free_file_space (ip, offset, len);if (error)
The i_mutex is completely redundant here. Not to mention there are multiple callers of these xfs_*_file_space() functions used to implement fallocate(), and we're not about to change the locking model for them....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 23:18, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
having run into that warning too, I looked into it a little, and now having found that patch am pretty uncertain: Both
truncate_setsize()andpagecache_isize_extended()document that they want to be called withi_mutexheld, so removing theWARN_ON()alone seems either incomplete or wrong. What I found to work without violating this documented requirement is the patch below.Or, just perhaps, the comments are wrong....
Right - that's what I was suggesting with the option of the patch being incomplete (rather than just removing the WARN_ON() it should also remove the respective comments then).
Jan
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 23:18, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
having run into that warning too, I looked into it a little, and now having found that patch am pretty uncertain: Both
truncate_setsize()andpagecache_isize_extended()document that they want to be called withi_mutexheld, so removing theWARN_ON()alone seems either incomplete or wrong. What I found to work without violating this documented requirement is the patch below.
Quoted 5 lines
Quoted 1 line
Or, just perhaps, the comments are wrong....
Right - that's what I was suggesting with the option of the patch being incomplete (rather than just removing the
WARN_ON()it should also remove the respective comments then).
Yeah, I'll update the comments to mention there are filesystem which use
serialization different from i_mutex. Thanks for catching this.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR