Skip to contentSkip to conversation

usbdevfs mount 2x, umount 1x

DISCUSSION Randy Dunlap 3 participants 3 messages Nov 30, 2000

lore
Share & tools
lore
#0 lore raw

[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

Signature · 9 lines
_______________________________________________
|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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#1 lore raw
Quoted 7 lines · Randy Dunlap

[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.

So umount it twice. And yes, it's "don't do it, then". Every mount() increments the use count. Every umount() decrements it. You want it to become 0. Draw your conclusions...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Randy Dunlap
Quoted 9 lines · Randy Dunlap

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

[root@dragon rdunlap]# lsmod
usbcore 50656 2 [uhci]

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

Are there usbdevfs entries in /proc/mount? Maybe 'umount' removes too many entries from /etc/mtab...

MfG, JBG

Signature · 4 lines
Fehler eingestehen, Größe zeigen: Nehmt die Rechtschreibreform zurück!!!
/* Jan-Benedict Glaw <[email protected]> -- +49-177-5601720 */
keyID=0x8399E1BB fingerprint=250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB
     "insmod vi.o and there we go..." (Alexander Viro on linux-kernel)