mirror of
https://github.com/AuxXxilium/kmod.git
synced 2025-01-18 18:07:26 +07:00
libkmod: always pass O_NONBLOCK to kernel
Not passsing O_NONBLOCK to delete_module() is deprecated since kmod 11 and is being removed from the kernel. Force this flag in libkmod.
This commit is contained in:
parent
82fc7d986c
commit
7ab8804448
10
NEWS
10
NEWS
@ -1,3 +1,11 @@
|
||||
kmod 16
|
||||
=======
|
||||
|
||||
- New features:
|
||||
- Remove option from libkmod to allow waiting on module removal if
|
||||
the module is being used. It's dangerous since it can block the
|
||||
caller indefinitely.
|
||||
|
||||
kmod 15
|
||||
=======
|
||||
|
||||
@ -82,7 +90,7 @@ kmod 11
|
||||
benefits.
|
||||
- Hide --wait option on rmmod. This feature is being targeted for
|
||||
removal from kernel. rmmod still accepts this option, but it's hidden
|
||||
now: man page and usage() says nothing about it and if it's used,
|
||||
now: man page and usage() say nothing about it and if it's used,
|
||||
user will get a 10s sleep. This way we can check and help if anyone
|
||||
is using this feature.
|
||||
- Refactor message logging on all tools, giving proper prefix, routing
|
||||
|
@ -738,15 +738,11 @@ extern long delete_module(const char *name, unsigned int flags);
|
||||
/**
|
||||
* kmod_module_remove_module:
|
||||
* @mod: kmod module
|
||||
* @flags: flags to pass to Linux kernel when removing the module, valid flags are
|
||||
* @flags: flags to pass to Linux kernel when removing the module. The only valid flag is
|
||||
* KMOD_REMOVE_FORCE: force remove module regardless if it's still in
|
||||
* use by a kernel subsystem or other process;
|
||||
* KMOD_REMOVE_NOWAIT: return immediately. It will fail if the module
|
||||
* is in using and KMOD_REMOVE_FORCE is not specified.
|
||||
* If this module is in use by any kernel subsystem or process, not using
|
||||
* this flag will cause the call to block indefinitely, until the module
|
||||
* is not in use anymore. Always use this flag, it's deprecated not using
|
||||
* it and the default behavior might change in future to always set it.
|
||||
* KMOD_REMOVE_NOWAIT is always enforced, causing us to pass O_NONBLOCK to
|
||||
* delete_module(2).
|
||||
*
|
||||
* Remove a module from Linux kernel.
|
||||
*
|
||||
@ -760,8 +756,9 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod,
|
||||
if (mod == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
/* Filter out other flags */
|
||||
flags &= (KMOD_REMOVE_FORCE | KMOD_REMOVE_NOWAIT);
|
||||
/* Filter out other flags and force ONONBLOCK */
|
||||
flags &= KMOD_REMOVE_FORCE;
|
||||
flags |= KMOD_REMOVE_NOWAIT;
|
||||
|
||||
err = delete_module(mod->name, flags);
|
||||
if (err != 0) {
|
||||
|
@ -140,7 +140,7 @@ struct kmod_module *kmod_module_get_module(const struct kmod_list *entry);
|
||||
/* Removal flags */
|
||||
enum kmod_remove {
|
||||
KMOD_REMOVE_FORCE = O_TRUNC,
|
||||
KMOD_REMOVE_NOWAIT = O_NONBLOCK,
|
||||
KMOD_REMOVE_NOWAIT = O_NONBLOCK, /* always set */
|
||||
};
|
||||
|
||||
/* Insertion flags */
|
||||
|
Loading…
Reference in New Issue
Block a user