Skip to contentSkip to conversation

lock held returning to user space (i_mutex_dir_key)

DISCUSSION Applied Dave Jones 3 participants 4 messages Sep 10, 2013 – Sep 12, 2013 VFS

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

================================================
[ BUG: lock held when returning to user space! ]
3.11.0+ #64 Not tainted
------------------------------------------------
trinity-child2/8333 is leaving the kernel with locks still held!
1 lock held by trinity-child2/8333:
#0: (&type->i_mutex_dir_key#3){+.+.+.}, at: [<ffffffff811c7fce>] mountpoint_last+0x4e/0x1a0

author
#1 lore raw
Quoted 7 lines · Dave Jones

================================================
[ BUG: lock held when returning to user space! ]
3.11.0+ #64 Not tainted
------------------------------------------------
trinity-child2/8333 is leaving the kernel with locks still held!
1 lock held by trinity-child2/8333:
#0: (&type->i_mutex_dir_key#3){+.+.+.}, at: [<ffffffff811c7fce>] mountpoint_last+0x4e/0x1a0

This perhaps ?

Signature · 3 lines
Add missing unlocks to error paths of mountpoint_last.

Signed-off-by: Dave Jones <[email protected]>
fs/namei.c +4 -1
index 409a441..5a91474 100644
@@ -2271,12 +2271,15 @@ mountpoint_last(struct nameidata *nd, struct path *path)
 		dentry = d_alloc(dir, &nd->last);
 		if (!dentry) {
 			error = -ENOMEM;
+			mutex_unlock(&dir->d_inode->i_mutex);
 			goto out;
 		}
 		dentry = lookup_real(dir->d_inode, dentry, nd->flags);
 		error = PTR_ERR(dentry);
-		if (IS_ERR(dentry))
+		if (IS_ERR(dentry)) {
+			mutex_unlock(&dir->d_inode->i_mutex);
 			goto out;
+		}
 	}
 	mutex_unlock(&dir->d_inode->i_mutex);
 
maintainer Applied
#2 lore raw
Quoted 10 lines · Dave Jones
Quoted 7 lines · Dave Jones

================================================
[ BUG: lock held when returning to user space! ]
3.11.0+ #64 Not tainted
------------------------------------------------
trinity-child2/8333 is leaving the kernel with locks still held!
1 lock held by trinity-child2/8333:
#0: (&type->i_mutex_dir_key#3){+.+.+.}, at: [<ffffffff811c7fce>] mountpoint_last+0x4e/0x1a0

This perhaps ?

Applied

Reviewed-by
#3 lore raw
In reply to Dave Jones
Quoted 29 lines · On Tue, 10 Sep 2013 17:04:25 -0400 Dave Jones <[email protected]> wrote:
Quoted 7 lines · Dave Jones

================================================
[ BUG: lock held when returning to user space! ]
3.11.0+ #64 Not tainted
------------------------------------------------
trinity-child2/8333 is leaving the kernel with locks still held!
1 lock held by trinity-child2/8333:
#0: (&type->i_mutex_dir_key#3){+.+.+.}, at: [<ffffffff811c7fce>] mountpoint_last+0x4e/0x1a0

This perhaps ?

Signature · 3 lines
Add missing unlocks to error paths of mountpoint_last.

Signed-off-by: Dave Jones <[email protected]>
fs/namei.c +1 -0
index 409a441..5a91474 100644
@@ -2271,12 +2271,15 @@ mountpoint_last(struct nameidata *nd, struct path *path)
 		dentry = d_alloc(dir, &nd->last);
 		if (!dentry) {
 			error = -ENOMEM;
+			mutex_unlock(&dir->d_inode->i_mutex);
 			goto out;
 		}

fs/namei.c mountpoint_last(struct nameidata *nd, struct path *path) · line 2285

Quoted 10 lines
fs/namei.c +3 -1
 		dentry = lookup_real(dir->d_inode, dentry, nd->flags);
 		error = PTR_ERR(dentry);
-		if (IS_ERR(dentry))
+		if (IS_ERR(dentry)) {
+			mutex_unlock(&dir->d_inode->i_mutex);
 			goto out;
+		}
 	}
 	mutex_unlock(&dir->d_inode->i_mutex);
 

Well spotted.