Skip to content
Snippets Groups Projects
Commit b717089e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R
Browse files

xfs: check XFS_EOFBLOCKS_RELEASED earlier in xfs_release_eofblocks


If the XFS_EOFBLOCKS_RELEASED flag is set, we are not going to free the
eofblocks, so don't bother locking the inode or performing the checks in
xfs_can_free_eofblocks.  Also switch to a test_and_set operation once
the iolock has been acquire so that only the caller that sets it actually
frees the post-EOF blocks.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent f1204d96
No related branches found
No related tags found
No related merge requests found
......@@ -1234,12 +1234,11 @@ xfs_file_release(
*/
if (inode->i_nlink &&
(file->f_mode & FMODE_WRITE) &&
!xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED) &&
xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) {
if (xfs_can_free_eofblocks(ip) &&
!xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED)) {
!xfs_iflags_test_and_set(ip, XFS_EOFBLOCKS_RELEASED))
xfs_free_eofblocks(ip);
xfs_iflags_set(ip, XFS_EOFBLOCKS_RELEASED);
}
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment