kpatch: add unload --all command

This may end up being useful in the distro patch module upgrade path.
If the core module also needs updating, we can first do "kpatch unload
--all" and "rmmod kpatch" before doing "kpatch load" of the new patch
module.
This commit is contained in:
Josh Poimboeuf 2014-07-23 09:16:11 -05:00
parent 77c8700888
commit d707c4062d
2 changed files with 15 additions and 2 deletions

View File

@ -42,6 +42,7 @@ usage () {
usage_cmd "load --all" "load all installed patch modules into the running kernel"
usage_cmd "load <module>" "load patch module into the running kernel"
usage_cmd "replace <module>" "load patch module into the running kernel, replacing all other modules"
usage_cmd "unload --all" "unload all patch modules from the running kernel"
usage_cmd "unload <module>" "unload patch module from the running kernel"
echo >&2
usage_cmd "info <module>" "show information about a patch module"
@ -164,9 +165,18 @@ case "$1" in
"unload")
[[ "$#" -ne 2 ]] && usage
[[ $2 =~ ^- ]] && usage
case "$2" in
"--all")
for module in /sys/kernel/kpatch/patches/*; do
[[ -e $module ]] || continue
unload_module $(basename $module) || die "failed to unload module $module"
done
;;
*)
unload_module "$(basename $2)" || die "failed to unload module $2"
;;
esac
;;
"install")
KVER=$(uname -r)

View File

@ -26,6 +26,9 @@ load <module>
replace <module>
load patch module into the running kernel, replacing all other modules
unload --all
unload all patch modules from the running kernel
unload <module>
unload patch module from the running kernel