* usbfs race while mounting/umounting
@ 2002-10-11 8:47 Wolfram Gloger
2002-10-11 12:34 ` Wolfram Gloger
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Gloger @ 2002-10-11 8:47 UTC (permalink / raw)
To: linux-kernel, greg
[Please CC me on replies, thx]
I use usbfs, but normally have only a single USB device connected, a
generic mouse. When usbfs is unmounted on shutdown, I see "BUG at
inode.c:1034" in between 5% and 50% of all cases, the backtrace being
iput(), free_inode(), usbdevfs_put_super(), kill_super(), __mntput(),
etc.
I believe this to be a long standing problem, I remember seeing this
in 2.2.x as well, more than a year ago. Then I moved the mouse to a
2.4.x system, and I've seen the problem ever since. As a workaround,
I have moved the "umount /proc/bus/usb" after all disk umounts, but I
believe I've now finally tracked down the cause.
drivers/usb/inode.c says that all calls of its inode-list-manipulating
functions must occur with the kernel lock held. usbdevfs_read_super()
does _not_ do this, however, and I strongly suspect that my mouse is
auto-detected (occasionally) exactly while usbfs is being mounted.
The result is that the same inode ends up twice in usbfs's lists,
hence the "BUG in inode.c:1034" when it is iput() twice on shutdown.
The appended patch has fixed the problem for me, although I've only
done a few boot cycles with it.
Regards,
Wolfram.
--- drivers/usb/inode.c.orig Sat Aug 3 02:39:45 2002
+++ drivers/usb/inode.c Fri Oct 11 10:13:13 2002
@@ -628,6 +628,7 @@
s->s_root = d_alloc_root(root_inode);
if (!s->s_root)
goto out_no_root;
+ lock_kernel();
list_add_tail(&s->u.usbdevfs_sb.slist, &superlist);
for (i = 0; i < NRSPECIAL; i++) {
if (!(inode = iget(s, IROOT+1+i)))
@@ -639,13 +640,12 @@
list_add_tail(&inode->u.usbdev_i.slist, &s->u.usbdevfs_sb.ilist);
list_add_tail(&inode->u.usbdev_i.dlist, &special[i].inodes);
}
- down (&usb_bus_list_lock);
for (blist = usb_bus_list.next; blist != &usb_bus_list; blist = blist->next) {
bus = list_entry(blist, struct usb_bus, bus_list);
new_bus_inode(bus, s);
recurse_new_dev_inode(bus->root_hub, s);
}
- up (&usb_bus_list_lock);
+ unlock_kernel();
return s;
out_no_root:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: usbfs race while mounting/umounting
2002-10-11 8:47 usbfs race while mounting/umounting Wolfram Gloger
@ 2002-10-11 12:34 ` Wolfram Gloger
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Gloger @ 2002-10-11 12:34 UTC (permalink / raw)
To: linux-kernel
Oliver Neukum made me look more closely and I think the
usb_bus_list_lock needs to stay, appended is a corrected patch for
2.4.x.
Regards,
Wolfram.
--- drivers/usb/inode.c.orig Sat Aug 3 02:39:45 2002
+++ drivers/usb/inode.c Fri Oct 11 14:33:34 2002
@@ -628,6 +628,7 @@
s->s_root = d_alloc_root(root_inode);
if (!s->s_root)
goto out_no_root;
+ lock_kernel();
list_add_tail(&s->u.usbdevfs_sb.slist, &superlist);
for (i = 0; i < NRSPECIAL; i++) {
if (!(inode = iget(s, IROOT+1+i)))
@@ -646,6 +647,7 @@
recurse_new_dev_inode(bus->root_hub, s);
}
up (&usb_bus_list_lock);
+ unlock_kernel();
return s;
out_no_root:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-10-11 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-11 8:47 usbfs race while mounting/umounting Wolfram Gloger
2002-10-11 12:34 ` Wolfram Gloger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®