[PATCH v3 08/12] fs/xfs: Clarify lockdep dependency for xfs_isilocked()

From: ira . weiny
Date: Sat Feb 08 2020 - 14:35:37 EST


From: Ira Weiny <ira.weiny@xxxxxxxxx>

xfs_isilocked() can't work fully without CONFIG_LOCKDEP. However,
making xfs_isilocked() dependant on CONFIG_LOCKDEP is not feasible
because it is used for more than the i_rwsem. Therefore a short-circuit
was provided via debug_locks. However, this caused confusion while
working through the xfs locking.

Rather than use debug_locks as a flag specify this clearly using
IS_ENABLED(CONFIG_LOCKDEP).

Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>

---
Changes from V2:
This patch is new for V3

fs/xfs/xfs_inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index c5077e6326c7..35df324875db 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -364,7 +364,7 @@ xfs_isilocked(

if (lock_flags & (XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED)) {
if (!(lock_flags & XFS_IOLOCK_SHARED))
- return !debug_locks ||
+ return !IS_ENABLED(CONFIG_LOCKDEP) ||
lockdep_is_held_type(&VFS_I(ip)->i_rwsem, 0);
return rwsem_is_locked(&VFS_I(ip)->i_rwsem);
}
--
2.21.0