Skip to content

Commit b717089

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
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: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent f1204d9 commit b717089

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/xfs/xfs_file.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,12 +1234,11 @@ xfs_file_release(
12341234
*/
12351235
if (inode->i_nlink &&
12361236
(file->f_mode & FMODE_WRITE) &&
1237+
!xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED) &&
12371238
xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) {
12381239
if (xfs_can_free_eofblocks(ip) &&
1239-
!xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED)) {
1240+
!xfs_iflags_test_and_set(ip, XFS_EOFBLOCKS_RELEASED))
12401241
xfs_free_eofblocks(ip);
1241-
xfs_iflags_set(ip, XFS_EOFBLOCKS_RELEASED);
1242-
}
12431242
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
12441243
}
12451244

0 commit comments

Comments
 (0)