Skip to contentSkip to conversation

2.5.5-pre1 rmmod usb-uhci hangs

DISCUSSION Pierre Rousselet 3 participants 7 messages Feb 15, 2002 USB

lore
Share & tools
lore
#0 lore raw

with 2.5.5-pre1 usb-uhci module can't unload. rmmod hangs, leaving the system unstable. in one circumstance the box freezed with an oops involving swapper pid0 . this doesn't happen with 2.5.4

# modprobe usb-uhci
# lsmod
usb-uhci    21924    0    (unused)
usbcore     60524    1    [usb-uhci]
# rmmod usb-uhci [hangs undefinitely in stat D]
  PID TTY      STAT   TIME COMMAND
  119 vc/1     D      0:00 rmmod usb-uhci
# lsmod
usb-uhci    0    0    (deleted)
usbcore    60524    1    [usb-uhci]

any clue ?

Pierre

Signature · 3 lines
------------------------------------------------
 Pierre Rousselet <[email protected]>
------------------------------------------------
#1 lore raw
Quoted 3 lines · Pierre Rousselet

with 2.5.5-pre1 usb-uhci module can't unload. rmmod hangs, leaving the system unstable. in one circumstance the box freezed with an oops involving swapper pid0 . this doesn't happen with 2.5.4

Try this (untested, I haven't rebooted yet) patch:

thanks,

greg k-h

drivers/usb/usb.c +3 -3
diff -Nru a/drivers/usb/usb.c b/drivers/usb/usb.c
@@ -1979,11 +1979,11 @@
 				if (driver->owner)
 					__MOD_DEC_USE_COUNT(driver->owner);
 				/* if driver->disconnect didn't release the interface */
-				if (interface->driver) {
-					put_device (&interface->dev);
+				if (interface->driver)
 					usb_driver_release_interface(driver, interface);
-				}
 			}
+			/* remove our device node for this interface */
+			put_device(&interface->dev);
 		}
 	}
 
#2 lore raw
In reply to Pierre Rousselet
Quoted 22 lines · Greg KH
Quoted 2 lines · Pierre Rousselet

with 2.5.5-pre1 usb-uhci module can't unload. rmmod hangs, leaving the system unstable. in one circumstance the box freezed with an oops involving swapper pid0 . this doesn't happen with 2.5.4

Try this (untested, I haven't rebooted yet) patch:

thanks,

greg k-h

diff -Nru a/drivers/usb/usb.c b/drivers/usb/usb.c

drivers/usb/usb.c +0 -1
@@ -1979,11 +1979,11 @@
 				if (driver->owner)
 					__MOD_DEC_USE_COUNT(driver->owner);
 				/* if driver->disconnect didn't release the interface */
-				if (interface->driver) {

drivers/usb/usb.c line 1989

Quoted 10 lines
drivers/usb/usb.c +3 -2
-					put_device (&interface->dev);
+				if (interface->driver)
 					usb_driver_release_interface(driver, interface);
-				}
 			}
+			/* remove our device node for this interface */
+			put_device(&interface->dev);
 		}
 	}
 

no, it doesn't solve the problem. i would like to test it whith preemtible kernel not set but it doesn't boot.

with both 2.5.4 and 2.5.5-pre1 when loading usb-uhci usb.c reports 2 devices :
device 1 : USB UHCI Root Hub
device 2 : Alcatel Speed Touch USB (the driver module and firmware are not loaded at this stage)

when rmmoding usb-uhci with 2.5.4 usb.c reports:
usb.c: USB disconnect on device 1
usb.c: USB disconnect on device 2

with 2.5.5-pre1
usb.c: USB disconnect on device 1
and nothing else.
Pierre

Signature · 3 lines
------------------------------------------------
 Pierre Rousselet <[email protected]>
------------------------------------------------
#3 lore raw
Quoted 3 lines

no, it doesn't solve the problem. i would like to test it whith preemtible kernel not set but it doesn't boot.

While Greg's patch did fix part of the problem, the rest of it was on my end. Could you try this patch, and see if helps?

Thanks,

-pat

===== fs/driverfs/inode.c 1.14 vs edited =====

fs/driverfs/inode.c +7 -34
@@ -585,29 +585,6 @@
 }
 
 /**
- * __remove_file - remove a regular file in the filesystem
- * @dentry:	dentry of file to remove
- *
- * Call unlink to remove the file, and dput on the dentry to drop
- * the refcount.
- */
-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 */
-	dput(dentry);
-
-	put_mount();
-}
-
-/**
  * driverfs_remove_file - exported file removal
  * @dir:	directory the file supposedly resides in
  * @name:	name of the file
@@ -617,14 +594,12 @@
  */
 void driverfs_remove_file(struct driver_dir_entry * dir, const char * name)
 {
-	struct dentry * dentry;
 	struct list_head * node;
 
 	if (!dir->dentry)
 		return;
 
-	dentry = dget(dir->dentry);
-	down(&dentry->d_inode->i_sem);
+	down(&dir->dentry->d_inode->i_sem);
 
 	node = dir->files.next;
 	while (node != &dir->files) {
@@ -633,14 +608,13 @@
 		entry = list_entry(node,struct driver_file_entry,node);
 		if (!strcmp(entry->name,name)) {
 			list_del_init(node);
-
-			__remove_file(entry->dentry);
+			vfs_unlink(entry->dentry->d_parent->d_inode,entry->dentry);
+			put_mount();
 			break;
 		}
 		node = node->next;
 	}
-	up(&dentry->d_inode->i_sem);
-	dput(dentry);
+	up(&dir->dentry->d_inode->i_sem);
 }
 
 /**
@@ -669,15 +643,14 @@
 		entry = list_entry(node,struct driver_file_entry,node);
 
 		list_del_init(node);
-
-		__remove_file(entry->dentry);
-
+		vfs_unlink(dentry->d_inode,entry->dentry);
+		put_mount();
 		node = dir->files.next;
 	}
+	up(&dentry->d_inode->i_sem);
 
 	vfs_rmdir(dentry->d_parent->d_inode,dentry);
 	up(&dentry->d_parent->d_inode->i_sem);
-	up(&dentry->d_inode->i_sem);
 	dput(dentry);
  done:
 	put_mount();
#4 lore raw
Quoted 6 lines · Patrick Mochel
Quoted 3 lines

no, it doesn't solve the problem. i would like to test it whith preemtible kernel not set but it doesn't boot.

While Greg's patch did fix part of the problem, the rest of it was on my end. Could you try this patch, and see if helps?

Actually, the patch that I sent is against my current tree, which includes some changes that I've already pushed to Linus. If you're using BK, you should be able to pull his current tree (if you're into that kinda thing). Or, wait until -pre2. Sorry about that.

-pat

#5 lore raw
Quoted 6 lines · Patrick Mochel
Quoted 3 lines · Patrick Mochel
Quoted 3 lines

no, it doesn't solve the problem. i would like to test it whith preemtible kernel not set but it doesn't boot.

Quoted 8 lines
Quoted 3 lines

While Greg's patch did fix part of the problem, the rest of it was on my end. Could you try this patch, and see if helps?

Actually, the patch that I sent is against my current tree, which includes some changes that I've already pushed to Linus. If you're using BK, you should be able to pull his current tree (if you're into that kinda thing). Or, wait until -pre2. Sorry about that.

well, it looks like my driverfs/inode.c has 20 lines or so more than yours, but *it works* (together with Greg's patch on usb.c).

good work

Pierre

Signature · 3 lines
------------------------------------------------
 Pierre Rousselet <[email protected]>
------------------------------------------------
#6 lore raw
In reply to Patrick Mochel
Quoted 7 lines · Patrick Mochel
Quoted 4 lines · Patrick Mochel
Quoted 3 lines

no, it doesn't solve the problem. i would like to test it whith preemtible kernel not set but it doesn't boot.

Quoted 7 lines
Quoted 2 lines

While Greg's patch did fix part of the problem, the rest of it was on my end. Could you try this patch, and see if helps?

Actually, the patch that I sent is against my current tree, which includes some changes that I've already pushed to Linus. If you're using BK, you should be able to pull his current tree (if you're into that kinda thing). Or, wait until -pre2. Sorry about that.

Your current tree, + this patch, + my patch solves all of the unloading, removing, and loading problems that I had been seeing.

Thanks for finding this.

greg k-h