[RFC PATCH v3 2/5] libfs: Remove unnecessary locking from simple_offset_empty()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chuck Lever <chuck.lever@xxxxxxxxxx>

I hit the DEBUG_LOCKS_WARN_ON() in hlock_class() several times
during testing. This indicates that simple_offset_empty() is
attempting to lock a negative dentry. That warning is of course
silent on a kernel that is built without lock debugging.

The simple_positive() check can be done without holding the
child's d_lock.

Fixes: ecba88a3b32d ("libfs: Add simple_offset_empty()")
Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 fs/libfs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index bf67954b525b..f686336489a3 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -347,13 +347,10 @@ int simple_offset_empty(struct dentry *dentry)
 	index = DIR_OFFSET_MIN;
 	octx = inode->i_op->get_offset_ctx(inode);
 	mt_for_each(&octx->mt, child, index, LONG_MAX) {
-		spin_lock(&child->d_lock);
 		if (simple_positive(child)) {
-			spin_unlock(&child->d_lock);
 			ret = 0;
 			break;
 		}
-		spin_unlock(&child->d_lock);
 	}
 
 	return ret;
-- 
2.47.0





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux