* why can't I remove a kernel module (or: what uses a given module)? @ 2006-12-03 11:20 Tomasz Chmielewski 2006-12-03 11:34 ` Andreas Schwab 0 siblings, 1 reply; 10+ messages in thread From: Tomasz Chmielewski @ 2006-12-03 11:20 UTC (permalink / raw) To: linux-kernel There is something I don't understand about loading and unloading kernel modules. I have a SATA controller, it uses a sata_mv driver. The drive connected to it is not used; it just "merely exists" - no one touches it. This is why I don't understand why I can't remove such a module: 1. # rmmod sata_mv ERROR: Module sata_mv is in use The module was loaded automatically during the system boot. mount claims no /dev/sda* partition is mounted. 2. In a second scenario, I move the kernel: # mv /lib/modules/2.6.19/kernel/drivers/ata/sata_mv.ko /root # reboot And load it later manually: # insmod ./sata_mv # dmesg -c sata_mv 0000:01:00.0: version 0.7 ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 20 (level, low) -> IRQ 23 (...) SCSI device sda: drive cache: write back sda: sda1 sd 24:0:0:0: Attached scsi disk sda We can remove the module without problems: # rmmod sata_mv # dmesg -c Synchronizing SCSI cache for disk sda: ACPI: PCI interrupt for device 0000:01:00.0 disabled Now I could remove the module without problems. What was using the module in the first scenario (I couldn't remove the module)? -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 11:20 why can't I remove a kernel module (or: what uses a given module)? Tomasz Chmielewski @ 2006-12-03 11:34 ` Andreas Schwab 2006-12-03 11:58 ` Tomasz Chmielewski 0 siblings, 1 reply; 10+ messages in thread From: Andreas Schwab @ 2006-12-03 11:34 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: linux-kernel Tomasz Chmielewski <mangoo@wpkg.org> writes: > What was using the module in the first scenario (I couldn't remove the > module)? Check lsmod for modules depending on this one. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 11:34 ` Andreas Schwab @ 2006-12-03 11:58 ` Tomasz Chmielewski 2006-12-03 15:49 ` Ross Vandegrift 0 siblings, 1 reply; 10+ messages in thread From: Tomasz Chmielewski @ 2006-12-03 11:58 UTC (permalink / raw) To: Andreas Schwab; +Cc: linux-kernel Andreas Schwab wrote: > Tomasz Chmielewski <mangoo@wpkg.org> writes: > >> What was using the module in the first scenario (I couldn't remove the >> module)? > > Check lsmod for modules depending on this one. You mean the "Used by" column? No, it's not used by any other module according to lsmod output. Any other methods of checking what uses /dev/sda*? -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 11:58 ` Tomasz Chmielewski @ 2006-12-03 15:49 ` Ross Vandegrift 2006-12-03 19:59 ` Tomasz Chmielewski 0 siblings, 1 reply; 10+ messages in thread From: Ross Vandegrift @ 2006-12-03 15:49 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: Andreas Schwab, linux-kernel On Sun, Dec 03, 2006 at 12:58:24PM +0100, Tomasz Chmielewski wrote: > You mean the "Used by" column? No, it's not used by any other module > according to lsmod output. > > Any other methods of checking what uses /dev/sda*? There's a good chance that if it was loaded at system boot, hald or udev may be doing something with it. When you loaded it manually, you didn't have udev rescan for devices so they didn't notice that you had loaded up a new disk. -- Ross Vandegrift ross@kallisti.us "The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell." --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 15:49 ` Ross Vandegrift @ 2006-12-03 19:59 ` Tomasz Chmielewski 2006-12-03 23:42 ` Jim Crilly 2006-12-04 10:10 ` Tobias Oed 0 siblings, 2 replies; 10+ messages in thread From: Tomasz Chmielewski @ 2006-12-03 19:59 UTC (permalink / raw) To: Ross Vandegrift; +Cc: Andreas Schwab, linux-kernel Ross Vandegrift wrote: > On Sun, Dec 03, 2006 at 12:58:24PM +0100, Tomasz Chmielewski wrote: >> You mean the "Used by" column? No, it's not used by any other module >> according to lsmod output. >> >> Any other methods of checking what uses /dev/sda*? > > There's a good chance that if it was loaded at system boot, hald or > udev may be doing something with it. This machine doesn't have hal; when I kill udevd still doesn't help. Yes, something's using that drive, be it a program, a module (unlikely), or something that is compiled directly in the kernel (for example, md/raid1). But what is it? Kernel knows it, as it refuses to remove the module (via rmmod), but how to tell kernel to share this knowledge with me? -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 19:59 ` Tomasz Chmielewski @ 2006-12-03 23:42 ` Jim Crilly 2006-12-04 8:02 ` Tomasz Chmielewski 2006-12-04 10:10 ` Tobias Oed 1 sibling, 1 reply; 10+ messages in thread From: Jim Crilly @ 2006-12-03 23:42 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: Ross Vandegrift, Andreas Schwab, linux-kernel On 12/03/06 08:59:10PM +0100, Tomasz Chmielewski wrote: > Ross Vandegrift wrote: > >On Sun, Dec 03, 2006 at 12:58:24PM +0100, Tomasz Chmielewski wrote: > >>You mean the "Used by" column? No, it's not used by any other module > >>according to lsmod output. > >> > >>Any other methods of checking what uses /dev/sda*? > > > >There's a good chance that if it was loaded at system boot, hald or > >udev may be doing something with it. > > This machine doesn't have hal; when I kill udevd still doesn't help. > > Yes, something's using that drive, be it a program, a module (unlikely), > or something that is compiled directly in the kernel (for example, > md/raid1). > But what is it? > > Kernel knows it, as it refuses to remove the module (via rmmod), but how > to tell kernel to share this knowledge with me? > Have you checked to make sure there's no swap partitions on it being automatically activated at boot? Also, have you checked the output of lsof? Jim. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 23:42 ` Jim Crilly @ 2006-12-04 8:02 ` Tomasz Chmielewski 0 siblings, 0 replies; 10+ messages in thread From: Tomasz Chmielewski @ 2006-12-04 8:02 UTC (permalink / raw) To: linux-kernel Jim Crilly wrote: > On 12/03/06 08:59:10PM +0100, Tomasz Chmielewski wrote: >> Ross Vandegrift wrote: >>> On Sun, Dec 03, 2006 at 12:58:24PM +0100, Tomasz Chmielewski wrote: >>>> You mean the "Used by" column? No, it's not used by any other module >>>> according to lsmod output. >>>> >>>> Any other methods of checking what uses /dev/sda*? >>> There's a good chance that if it was loaded at system boot, hald or >>> udev may be doing something with it. >> This machine doesn't have hal; when I kill udevd still doesn't help. >> >> Yes, something's using that drive, be it a program, a module (unlikely), >> or something that is compiled directly in the kernel (for example, >> md/raid1). >> But what is it? >> >> Kernel knows it, as it refuses to remove the module (via rmmod), but how >> to tell kernel to share this knowledge with me? >> > > Have you checked to make sure there's no swap partitions on it being > automatically activated at boot? Also, have you checked the output of lsof? The machine doesn't even have swap, so no, no swap on that device (confirmed by th output of free with 0 swap). The device doesn't also show up in /etc/fstab. And "lsof -n | grep sd" doesn't show anything. -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-03 19:59 ` Tomasz Chmielewski 2006-12-03 23:42 ` Jim Crilly @ 2006-12-04 10:10 ` Tobias Oed 2006-12-04 10:39 ` Tomasz Chmielewski 2006-12-05 0:15 ` Michal Jaegermann 1 sibling, 2 replies; 10+ messages in thread From: Tobias Oed @ 2006-12-04 10:10 UTC (permalink / raw) To: linux-kernel Tomasz Chmielewski wrote: > Ross Vandegrift wrote: >> On Sun, Dec 03, 2006 at 12:58:24PM +0100, Tomasz Chmielewski wrote: >>> You mean the "Used by" column? No, it's not used by any other module >>> according to lsmod output. >>> >>> Any other methods of checking what uses /dev/sda*? >> >> There's a good chance that if it was loaded at system boot, hald or >> udev may be doing something with it. > > This machine doesn't have hal; when I kill udevd still doesn't help. > > Yes, something's using that drive, be it a program, a module (unlikely), > or something that is compiled directly in the kernel (for example, > md/raid1). > But what is it? Since you mention md, dm comes to mind. I have seen a couple of drives that were previously attached to fake raid controllers becoming unavailable when moved to a normal controller. I haven't found the one size workaround for the problem yet. Can you check /sys/block/sda/holders ? Also /sys/bus/ide/whoevertheholderis/[bind|unbind] are 'curious' but I'm not sure how one is supposed to use them. Tobias ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-04 10:10 ` Tobias Oed @ 2006-12-04 10:39 ` Tomasz Chmielewski 2006-12-05 0:15 ` Michal Jaegermann 1 sibling, 0 replies; 10+ messages in thread From: Tomasz Chmielewski @ 2006-12-04 10:39 UTC (permalink / raw) To: tobiasoed; +Cc: linux-kernel Tobias Oed wrote: > Tomasz Chmielewski wrote: > >> Ross Vandegrift wrote: >>> On Sun, Dec 03, 2006 at 12:58:24PM +0100, Tomasz Chmielewski wrote: >>>> You mean the "Used by" column? No, it's not used by any other module >>>> according to lsmod output. >>>> >>>> Any other methods of checking what uses /dev/sda*? >>> There's a good chance that if it was loaded at system boot, hald or >>> udev may be doing something with it. >> This machine doesn't have hal; when I kill udevd still doesn't help. >> >> Yes, something's using that drive, be it a program, a module (unlikely), >> or something that is compiled directly in the kernel (for example, >> md/raid1). >> But what is it? > > Since you mention md, dm comes to mind. I have seen a couple of drives that > were previously attached to fake raid controllers becoming unavailable when > moved to a normal controller. I haven't found the one size workaround for > the problem yet. Can you check > /sys/block/sda/holders ? Yes, that was the right answer. On a system with sata_mv (machine_1) I indeed had RAID, and that's why I suspected I couldn't remove the module. It was confirmed by checking /sys/block/sda/sda1/holders: # ls /sys/block/sda/sda1/holders md0@ On yet another system (machine_2), with sata_via module, I didn't set up RAID, but still, I couldn't remove the module. Inspecting /sys/block/sda/sda1/holders revealed why: # ls /sys/block/sda/sda1/holders dm-0@ dm-1@ dm-2@ The drive was taken from the machine_1; it had LVM2 on it. Thanks! -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: why can't I remove a kernel module (or: what uses a given module)? 2006-12-04 10:10 ` Tobias Oed 2006-12-04 10:39 ` Tomasz Chmielewski @ 2006-12-05 0:15 ` Michal Jaegermann 1 sibling, 0 replies; 10+ messages in thread From: Michal Jaegermann @ 2006-12-05 0:15 UTC (permalink / raw) To: Tobias Oed; +Cc: linux-kernel On Mon, Dec 04, 2006 at 11:10:01AM +0100, Tobias Oed wrote: > Tomasz Chmielewski wrote: > > > Yes, something's using that drive, be it a program, a module (unlikely), > > or something that is compiled directly in the kernel (for example, > > md/raid1). > > Since you mention md, dm comes to mind. I have seen a couple of drives that > were previously attached to fake raid controllers becoming unavailable when > moved to a normal controller. I haven't found the one size workaround for > the problem yet. dmraid -r -E <device_in_question> Yes, I was hit by this in a different context. A command is described on 'man dmraid' but figuring out what was the issue took me a long while. Michal ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-12-05 0:15 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-12-03 11:20 why can't I remove a kernel module (or: what uses a given module)? Tomasz Chmielewski 2006-12-03 11:34 ` Andreas Schwab 2006-12-03 11:58 ` Tomasz Chmielewski 2006-12-03 15:49 ` Ross Vandegrift 2006-12-03 19:59 ` Tomasz Chmielewski 2006-12-03 23:42 ` Jim Crilly 2006-12-04 8:02 ` Tomasz Chmielewski 2006-12-04 10:10 ` Tobias Oed 2006-12-04 10:39 ` Tomasz Chmielewski 2006-12-05 0:15 ` Michal Jaegermann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox