From: Pravin Shedge <pravin.shedge4linux@gmail.com>
To: dave@stgolabs.net, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: pravin.shedge4linux@gmail.com
Subject: [PATCH 2/2] lib: Remove module auto-unloading which encourages inconsistent behaviour
Date: Sat, 23 Dec 2017 20:58:49 +0530 [thread overview]
Message-ID: <1514042929-8120-1-git-send-email-pravin.shedge4linux@gmail.com> (raw)
The module auto-unload might seem like a nice optimization, but
it encourages inconsistent behaviour. And behaviour that is
different from all other normal modules.
rbtree_test.c and percpu_test.c returns -EAGAIN from module_init()
on successful completion. Normal module return 0 on success but
returning -EAGAIN perform auto module unloading which seem like
a nice optimization but it brings inconsistent behaviour as well.
I face the similar problem in my previous patch, "Paul Gortmaker"
gives nice review comment on module auto-unloading brings
inconsistent behaviour.
Imagine something as simple as this:
for i in $LIST ; do
modprobe $i
lsmod | grep -q $i
if [ $? != 0 ]; then echo Module $i is not present! ; fi
done
OK, not ideal code, ignoring the modprobe return -- but what it reports
is true --
rbtree_test.c and percpu_test.c test module (if it passed) will NOT be
present.
All other modules from linux/lib/* follow the same semantics that
module_init() returns 0 on successful completion & let external entity
like rmmod do the module unloading task.
Signed-off-by: Pravin Shedge <pravin.shedge4linux@gmail.com>
---
lib/percpu_test.c | 3 ++-
lib/rbtree_test.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/percpu_test.c b/lib/percpu_test.c
index 0b5d14d..57a637b 100644
--- a/lib/percpu_test.c
+++ b/lib/percpu_test.c
@@ -123,7 +123,8 @@ static int __init percpu_test_init(void)
preempt_enable();
pr_info("percpu test done\n");
- return -EAGAIN; /* Fail will directly unload the module */
+
+ return 0;
}
static void __exit percpu_test_exit(void)
diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c
index 7d36c1e..5c52112 100644
--- a/lib/rbtree_test.c
+++ b/lib/rbtree_test.c
@@ -394,7 +394,7 @@ static int __init rbtree_test_init(void)
kfree(nodes);
- return -EAGAIN; /* Fail will directly unload the module */
+ return 0;
}
static void __exit rbtree_test_exit(void)
--
2.7.4
next reply other threads:[~2017-12-23 15:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-23 15:28 Pravin Shedge [this message]
2017-12-29 16:47 ` Andy Shevchenko
2018-01-01 17:10 ` Pravin Shedge
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=1514042929-8120-1-git-send-email-pravin.shedge4linux@gmail.com \
--to=pravin.shedge4linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®