this patch can be replaced by an open source patch: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/?id=c2996b5fa880e81f63c25e80a4157b2239e32c5d Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
32 lines
972 B
Diff
32 lines
972 B
Diff
From e48b7f950e8a6c8b6ba825a14a5aeb8a5064cdfc Mon Sep 17 00:00:00 2001
|
|
From: Liu Chao <liuchao173@huawei.com>
|
|
Date: Mon, 7 Jun 2021 06:46:49 +0000
|
|
Subject: [PATCH] kmod: don't check module's refcnt when rmmod with -r
|
|
|
|
When we remove module that only kernel livepatches depend on it by
|
|
remmod -r, we want to only invoke resume function. But kmod will check
|
|
refcnt first, if refcnt is more than zero, kmod won't call kernel's
|
|
delete_module.
|
|
|
|
Signed-off-by: Liu Chao <liuchao173@huawei.com>
|
|
---
|
|
tools/rmmod.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/tools/rmmod.c b/tools/rmmod.c
|
|
index 1278234..1d8d20b 100644
|
|
--- a/tools/rmmod.c
|
|
+++ b/tools/rmmod.c
|
|
@@ -178,7 +178,7 @@ static int do_rmmod(int argc, char *argv[])
|
|
break;
|
|
}
|
|
|
|
- if (!(flags & KMOD_REMOVE_FORCE) && check_module_inuse(mod) < 0) {
|
|
+ if (!(flags & KMOD_REMOVE_FORCE) && !(flags & KMOD_REMOVE_REPLACE) && check_module_inuse(mod) < 0) {
|
|
r++;
|
|
goto next;
|
|
}
|
|
--
|
|
2.23.0
|
|
|