From e48b7f950e8a6c8b6ba825a14a5aeb8a5064cdfc Mon Sep 17 00:00:00 2001 From: Liu Chao 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 --- 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