From 7a623868b280b0f8c38e0652ac9442a23c569b17 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 15 Mar 2010 15:34:38 +0000 Subject: [PATCH] modprobe: fix softdep flags 1. When a softdep is present, all the flags e.g. --use-blacklist are being ignored. Fix that. 2. When processing softdeps, mask out the "first_time" flag. This brings them into line with both install commands and normal dependencies. (We don't need to worry about "ignore_commands", because it would prevent softdeps from being loaded in the first place). If we're unloading, we should also mask in the "quiet_inuse" flag. --- modprobe.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modprobe.c b/modprobe.c index 47f3a9b..0f9494e 100644 --- a/modprobe.c +++ b/modprobe.c @@ -1325,8 +1325,14 @@ static void do_softdep(const struct module_softdep *softdep, modprobe_flags_t flags) { struct string_table *pre_modnames, *post_modnames; + modprobe_flags_t softdep_flags = flags; int i, j; + softdep_flags &= ~mit_first_time; + softdep_flags &= ~mit_ignore_commands; + if (flags & mit_remove) + softdep_flags |= mit_quiet_inuse; + if (++recursion_depth >= MAX_RECURSION) fatal("modprobe: softdep dependency loop encountered %s %s\n", (flags & mit_remove) ? "removing" : "inserting", @@ -1348,7 +1354,7 @@ static void do_softdep(const struct module_softdep *softdep, j = (flags & mit_remove) ? pre_modnames->cnt-1 - i : i; do_modprobe(pre_modnames->str[j], NULL, "", - conf, dirname, warn, flags); + conf, dirname, warn, softdep_flags); } /* Modprobe main module, passing cmdline_opts, ignoring softdep */ @@ -1363,7 +1369,7 @@ static void do_softdep(const struct module_softdep *softdep, j = (flags & mit_remove) ? post_modnames->cnt-1 - i : i; do_modprobe(post_modnames->str[j], NULL, "", conf, - dirname, warn, flags); + dirname, warn, softdep_flags); } } @@ -1416,8 +1422,7 @@ static int insmod(struct list_head *list, softdep = find_softdep(mod->modname, conf->softdeps); if (softdep && !(flags & mit_ignore_commands)) { - do_softdep(softdep, cmdline_opts, conf, dirname, - error, flags & (mit_remove | mit_dry_run)); + do_softdep(softdep, cmdline_opts, conf, dirname, error, flags); goto out; } @@ -1512,8 +1517,7 @@ static void rmmod(struct list_head *list, softdep = find_softdep(mod->modname, conf->softdeps); if (softdep && !(flags & mit_ignore_commands)) { - do_softdep(softdep, cmdline_opts, conf, dirname, - error, flags & (mit_remove | mit_dry_run)); + do_softdep(softdep, cmdline_opts, conf, dirname, error, flags); goto remove_rest; } -- 2.11.4.GIT