From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Richard Palethorpe <rpalethorpe@suse.com>
Subject: Re: [LTP] [PATCH 1/1] lib/tst_module.c: Replace "rmmod" with "modprobe -r"
Date: Fri, 3 Nov 2023 19:54:20 +0100 [thread overview]
Message-ID: <20231103185420.GA1111882@pevik> (raw)
In-Reply-To: <20231103160350.1096410-1-pvorel@suse.cz>
Hi all,
> "modprobe -r" will remove also the dependencies loaded for kernel
> modules.
> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> lib/tst_module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/lib/tst_module.c b/lib/tst_module.c
> index 9bd443623..e52bb6e00 100644
> --- a/lib/tst_module.c
> +++ b/lib/tst_module.c
> @@ -105,7 +105,7 @@ void tst_module_unload_(void (cleanup_fn)(void), const char *mod_name)
> {
> int i, rc;
> - const char *const argv[] = { "rmmod", mod_name, NULL };
> + const char *const argv[] = { "modprobe", "-r", mod_name, NULL };
I'm sorry, obviously some modules needs rmmod:
# ./delete_module03
...
delete_module03.c:32: TPASS: delete_module() failed as expected: EAGAIN/EWOULDBLOCK (11)
tst_module.c:121: TWARN: could not unload dummy_del_mod_dep.ko module
tst_module.c:121: TWARN: could not unload dummy_del_mod.ko module
...
# ./delete_module03
insmod: ERROR: could not insert module dummy_del_mod.ko: File exists
tst_cmd.c:121: TBROK: 'insmod' exited with a non-zero code 1 at tst_cmd.c:121
It's because these modules cannot be found by modprobe
# modprobe -r dummy_del_mod_dep
modprobe: FATAL: Module dummy_del_mod_dep not found.
# modprobe -r dummy_del_mod
modprobe: FATAL: Module dummy_del_mod not found.
# rmmod dummy_del_mod_dep; echo $?; rmmod dummy_del_mod; echo $?
0
0
I guess for .modprobe_module we should have function which uses 'modprobe -r'.
And we should keep tst_module_unload() for these special cases. I would rename
it to tst_module_rmmod() to be obvious.
Setting this as changes requested, next week there is Hackweek in SUSE, I'll
send v3 following week.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2023-11-03 18:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 16:03 [LTP] [PATCH 1/1] lib/tst_module.c: Replace "rmmod" with "modprobe -r" Petr Vorel
2023-11-03 16:53 ` Edward Liaw via ltp
2023-11-03 22:16 ` Petr Vorel
2023-11-03 23:02 ` Edward Liaw via ltp
2023-11-03 18:54 ` Petr Vorel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231103185420.GA1111882@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rpalethorpe@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.