libkmod-module: probe: return -EEXIST if told to stop on already loaded

This commit is contained in:
Lucas De Marchi 2012-01-31 11:29:06 -02:00
parent fa0046ba83
commit 3bc92e8949
2 changed files with 8 additions and 8 deletions

View File

@ -1186,7 +1186,7 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
state == KMOD_MODULE_COMING ||
state == KMOD_MODULE_BUILTIN) {
if (m == mod && (flags & KMOD_PROBE_STOP_ON_ALREADY_LOADED)) {
err = KMOD_PROBE_STOP_ON_ALREADY_LOADED;
err = -EEXIST;
break;
}
@ -1206,8 +1206,8 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
/*
* Treat "already loaded" error. If we were told to stop on
* already loaded and the module being loaded is not a
* softdep, bail out. Otherwise, just ignore and continue.
* already loaded and the module being loaded is not a softdep
* or dep, bail out. Otherwise, just ignore and continue.
*
* We need to check here because of race conditions. We
* checked first if module was already loaded but it may have
@ -1215,12 +1215,12 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
* insert it.
*/
if (err == -EEXIST && m == mod &&
(flags & KMOD_PROBE_STOP_ON_ALREADY_LOADED)) {
err = KMOD_PROBE_STOP_ON_ALREADY_LOADED;
(flags & KMOD_PROBE_STOP_ON_ALREADY_LOADED))
break;
}
if (err < 0 && err != -EEXIST)
if (err == -EEXIST)
err = 0;
else if (err < 0)
break;
}

View File

@ -130,12 +130,12 @@ enum kmod_probe {
KMOD_PROBE_IGNORE_COMMAND = 0x00004,
KMOD_PROBE_IGNORE_LOADED = 0x00008,
KMOD_PROBE_DRY_RUN = 0x00010,
KMOD_PROBE_STOP_ON_ALREADY_LOADED = 0x00020,
/* codes below can be used in return value, too */
KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000,
KMOD_PROBE_APPLY_BLACKLIST = 0x20000,
KMOD_PROBE_STOP_ON_COMMAND = 0x40000,
KMOD_PROBE_STOP_ON_ALREADY_LOADED = 0x80000,
};
/*