[PATCH] modprobe: don't check refcount with remove command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johannes Berg <johannes.berg@xxxxxxxxx>

The modprobe.d (5) documentation for the "install" command
states that you could specify

install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred

This makes some sense, but then the loading of "barney" is
hidden from the user who did only "modprobe fred". Thus,
it seems it should be possible to be able to unload the
"fred" module with "modprobe -r fred" by configuring the
"barney" module to also be removed:

remove fred /sbin/rmmod barney fred

(or similar.)

Make this possible by not checking the refcount when an
unload command was configured.

Reported-by: David Spinadel <david.spinadel@xxxxxxxxx>
---
 tools/modprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/modprobe.c b/tools/modprobe.c
index a053efb..6b34658 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -386,7 +386,7 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
 			goto error;
 	}
 
-	if (!ignore_loaded) {
+	if (!ignore_loaded && !cmd) {
 		int usage = kmod_module_get_refcnt(mod);
 
 		if (usage > 0) {
-- 
1.8.0

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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux