Commit 3b4683c2 authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong

xfs: drop iolock from reclaim context to appease lockdep

Lockdep complains about use of the iolock in inode reclaim context
because it doesn't understand that reclaim has the last reference to
the inode, and thus an iolock->reclaim->iolock deadlock is not
possible.

The iolock is technically not necessary in xfs_inactive() and was
only added to appease an assert in xfs_free_eofblocks(), which can
be called from other non-reclaim contexts. Therefore, just kill the
assert and drop the use of the iolock from reclaim context to quiet
lockdep.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 5146d0b7
...@@ -903,9 +903,9 @@ xfs_can_free_eofblocks(struct xfs_inode *ip, bool force) ...@@ -903,9 +903,9 @@ xfs_can_free_eofblocks(struct xfs_inode *ip, bool force)
} }
/* /*
* This is called by xfs_inactive to free any blocks beyond eof * This is called to free any blocks beyond eof. The caller must hold
* when the link count isn't zero and by xfs_dm_punch_hole() when * IOLOCK_EXCL unless we are in the inode reclaim path and have the only
* punching a hole to EOF. * reference to the inode.
*/ */
int int
xfs_free_eofblocks( xfs_free_eofblocks(
...@@ -920,8 +920,6 @@ xfs_free_eofblocks( ...@@ -920,8 +920,6 @@ xfs_free_eofblocks(
struct xfs_bmbt_irec imap; struct xfs_bmbt_irec imap;
struct xfs_mount *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));
/* /*
* Figure out if there are any blocks beyond the end * Figure out if there are any blocks beyond the end
* of the file. If not, then there is nothing to do. * of the file. If not, then there is nothing to do.
......
...@@ -1906,12 +1906,13 @@ xfs_inactive( ...@@ -1906,12 +1906,13 @@ xfs_inactive(
* force is true because we are evicting an inode from the * force is true because we are evicting an inode from the
* cache. Post-eof blocks must be freed, lest we end up with * cache. Post-eof blocks must be freed, lest we end up with
* broken free space accounting. * broken free space accounting.
*
* Note: don't bother with iolock here since lockdep complains
* about acquiring it in reclaim context. We have the only
* reference to the inode at this point anyways.
*/ */
if (xfs_can_free_eofblocks(ip, true)) { if (xfs_can_free_eofblocks(ip, true))
xfs_ilock(ip, XFS_IOLOCK_EXCL);
xfs_free_eofblocks(ip); xfs_free_eofblocks(ip);
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
}
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment