usbdevfs mount 2x, umount 1x

From: Randy Dunlap (randy.dunlap@intel.com)
Date: Wed Nov 29 2000 - 19:47:27 EST


[I reported this a couple of months back. Got no
feedback on it. If it's just a DDT (don't do that)
or a user error, please say so.]

Summary: After I mount usbdevfs 2 times, and umount it
1 time, the usbcore module use count prevents it from
being rmmod-ed.

This is test12-pre2.

1. Start by loading usbcore and uhci modules:
 
[root@dragon rdunlap]# lsmod
Module Size Used by
uhci 18848 0 (unused)
usbcore 50656 0 [uhci]

and the /proc/bus/usb mount point is empty:

[rdunlap@dragon rdunlap]$ ls -l /proc/bus/usb
total 0

2. I enter "mount usb", which uses this entry
from /etc/fstab:
usb /proc/bus/usb usbdevfs defaults,user 0 0

'mount' then tells me (usb line extracted):

usb on /proc/bus/usb type usbdevfs (rw,noexec,nosuid,nodev)

and 'lsmod' tells me:

[root@dragon rdunlap]# lsmod
Module Size Used by
uhci 18848 0 (unused)
usbcore 50656 1 [uhci]

3. Some time passes. I mount usbdevfs again, by entering:

[root@dragon rdunlap]# mount -t usbdevfs usbdevfs /proc/bus/usb

'lsmod' now tells me:

[root@dragon rdunlap]# lsmod
Module Size Used by
uhci 18848 0 (unused)
usbcore 50656 2 [uhci]

and 'mount' tells me:

usb on /proc/bus/usb type usbdevfs (rw,noexec,nosuid,nodev)
usbdevfs on /proc/bus/usb type usbdevfs (rw)

4. I 'umount usbdevfs'. Now 'lsmod' tells me:

[root@dragon rdunlap]# umount usbdevfs
[root@dragon rdunlap]# lsmod
Module Size Used by
uhci 18848 0 (unused)
usbcore 50656 1 [uhci]

and 'mount' shows no usb or usbdevfs entries listed.

Now I rmmod uhci and 'lsmod' tells me:

[root@dragon rdunlap]# rmmod uhci
[root@dragon rdunlap]# lsmod
Module Size Used by
usbcore 50656 1

and I can't rmmod usbcore. The /proc/bus/usb mount
point is still populated and the 'drivers' file
contains correct data:

[rdunlap@dragon rdunlap]$ ls -l /proc/bus/usb
total 0
-r--r--r-- 1 root root 0 Nov 29 16:17 devices
-r--r--r-- 1 root root 0 Nov 29 16:17 drivers

[rdunlap@dragon rdunlap]$ cat /proc/bus/usb/drivers
         hub
         usbdevfs
[rdunlap@dragon rdunlap]$

So is this just a case of root being able to shoot self
in foot or a proc-fs or module counter problem?

Notes:
1. Reversing the order of steps 3 and 4 gives the
same results.
2. Changing the device name in
'mount -t usbdevfs usbdevfs /proc/bus/usb' to be
'mount -t usbdevfs usbfs /proc/bus/usb' gives the
same results (when followed by 'umount usbfs').

Thanks,
~Randy

-- 
_______________________________________________
|randy.dunlap_at_intel.com        503-677-5408|
|NOTE: Any views presented here are mine alone|
|& may not represent the views of my employer.|
-----------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Nov 30 2000 - 21:00:23 EST