]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
modprobe: don't check refcount with remove command
authorJohannes Berg <johannes.berg@intel.com>
Thu, 2 May 2013 13:23:28 +0000 (15:23 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 3 May 2013 02:30:44 +0000 (23:30 -0300)
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@intel.com>
tools/modprobe.c

index a053efb7576d60e19fbb4838d4a0c5aa7904a463..6b34658d71e093bfcf2c8032dd99f655bc1a378c 100644 (file)
@@ -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) {