Re: why can't I remove a kernel module (or: what uses a given module)?

From: Tomasz Chmielewski
Date: Mon Dec 04 2006 - 05:40:33 EST


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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/