Skip to contentSkip to conversation

remove unneeded inode semaphores from driverfs

PATCH In review Andrey Panin 3 participants 4 messages Feb 26, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove unneeded inode semaphores from driverfs

Hi,

__remove_file() in driverfs/inode.c calls down(&dentry->d_inode->i_sem) before calling vfs_unlink(dentry->d_parent->d_inode,dentry) which tries to claim the same semaphore causing the livelock. driverfs_remove_dir() makes the same calling vfs_rmdir().

These bugs are triggered by driverfs for IDE patch by Pavel Machek.

Best regards.

Signature · 2 lines
Andrey Panin            | Embedded systems software engineer
[email protected]        | PGP key: wwwkeys.eu.pgp.net
linux/fs/driverfs/inode.c renamed from linux.vanilla/fs/driverfs/inode.c +0 -4
diff -urN -X /usr/share/dontdiff /linux.vanilla/fs/driverfs/inode.c /linux/fs/driverfs/inode.c
@@ -698,11 +698,9 @@
 static void __remove_file(struct dentry * dentry)
 {
 	dget(dentry);
-	down(&dentry->d_inode->i_sem);
 
 	vfs_unlink(dentry->d_parent->d_inode,dentry);
 
-	up(&dentry->d_inode->i_sem);
 	dput(dentry);
 
 	/* remove reference count from when file was created */
@@ -766,7 +764,6 @@
 	dentry = dget(dir->dentry);
 	dget(dentry->d_parent);
 	down(&dentry->d_parent->d_inode->i_sem);
-	down(&dentry->d_inode->i_sem);
 
 	node = dir->files.next;
 	while (node != &dir->files) {
@@ -782,7 +779,6 @@
 
 	vfs_rmdir(dentry->d_parent->d_inode,dentry);
 	up(&dentry->d_parent->d_inode->i_sem);
-	up(&dentry->d_inode->i_sem);
 
 	/* remove reference count from when directory was created */
 	dput(dentry);
#1 lore raw
Quoted 6 lines · Andrey Panin

Hi,

__remove_file() in driverfs/inode.c calls down(&dentry->d_inode->i_sem) before calling vfs_unlink(dentry->d_parent->d_inode,dentry) which tries to claim the same semaphore causing the livelock. driverfs_remove_dir() makes the same calling vfs_rmdir().

What kernel version did you generate this patch for? This patch doesn't apply at all to 2.5.5, and it looks like this problem is already fixed.

thanks,

greg k-h

#2 lore raw
In reply to Andrey Panin
Quoted 10 lines · Greg KH
Quoted 6 lines · Andrey Panin

Hi,

__remove_file() in driverfs/inode.c calls down(&dentry->d_inode->i_sem) before calling vfs_unlink(dentry->d_parent->d_inode,dentry) which tries to claim the same semaphore causing the livelock. driverfs_remove_dir() makes the same calling vfs_rmdir().

What kernel version did you generate this patch for? This patch doesn't apply at all to 2.5.5, and it looks like this problem is already fixed.

It's against 2.5.5-pre1, I was out of the net for some days and couldn't check final 2.5.5.

Signature · 2 lines
Andrey Panin            | Embedded systems software engineer
[email protected]        | PGP key: wwwkeys.eu.pgp.net
#3 lore raw
Quoted 9 lines · Andrey Panin
Quoted 8 lines · Greg KH
Quoted 6 lines · Andrey Panin

Hi,

__remove_file() in driverfs/inode.c calls down(&dentry->d_inode->i_sem) before calling vfs_unlink(dentry->d_parent->d_inode,dentry) which tries to claim the same semaphore causing the livelock. driverfs_remove_dir() makes the same calling vfs_rmdir().

Quoted 7 lines
Quoted 2 lines

What kernel version did you generate this patch for? This patch doesn't apply at all to 2.5.5, and it looks like this problem is already fixed.

It's against 2.5.5-pre1, I was out of the net for some days and couldn't check final 2.5.5.

From the changelog, it is only the mysterious "device model/driverfs

updates", but it should have indeed been fixed in 2.5.5.

Thanks,

-pat