public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Wang Weidong <wangweidong1@huawei•com>
To: Vlad Yasevich <vyasevich@gmail•com>,
	Neil Horman <nhorman@tuxdriver•com>,
	David Miller <davem@davemloft•net>
Cc: <netdev@vger•kernel.org>, <linux-sctp@vger•kernel.org>
Subject: [PATCH v2] sctp: loading sctp when load sctp_probe
Date: Fri, 13 Dec 2013 11:00:10 +0800	[thread overview]
Message-ID: <52AA783A.7090502@huawei.com> (raw)

when I modprobe sctp_probe, it failed with "FATAL: ". I found that
sctp should load before sctp_probe register jprobe. So I add a
sctp_setup_jprobe for loading 'sctp' when first failed to register
jprobe, just do this similar to dccp_probe.

v2: add MODULE_SOFTDEP and check of request_module, as suggested by Neil

Signed-off-by: Wang Weidong <wangweidong1@huawei•com>
---
 net/sctp/probe.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/net/sctp/probe.c b/net/sctp/probe.c
index 53c452e..5e68b94 100644
--- a/net/sctp/probe.c
+++ b/net/sctp/probe.c
@@ -38,6 +38,7 @@
 #include <net/sctp/sctp.h>
 #include <net/sctp/sm.h>
 
+MODULE_SOFTDEP("pre: sctp");
 MODULE_AUTHOR("Wei Yongjun <yjwei@cn•fujitsu.com>");
 MODULE_DESCRIPTION("SCTP snooper");
 MODULE_LICENSE("GPL");
@@ -182,6 +183,20 @@ static struct jprobe sctp_recv_probe = {
 	.entry	= jsctp_sf_eat_sack,
 };
 
+static __init int sctp_setup_jprobe(void)
+{
+	int ret = register_jprobe(&sctp_recv_probe);
+
+	if (ret) {
+		if (request_module("sctp"))
+			goto out;
+		ret = register_jprobe(&sctp_recv_probe);
+	}
+
+out:
+	return ret;
+}
+
 static __init int sctpprobe_init(void)
 {
 	int ret = -ENOMEM;
@@ -202,7 +217,7 @@ static __init int sctpprobe_init(void)
 			 &sctpprobe_fops))
 		goto free_kfifo;
 
-	ret = register_jprobe(&sctp_recv_probe);
+	ret = sctp_setup_jprobe();
 	if (ret)
 		goto remove_proc;
 
-- 
1.7.12

             reply	other threads:[~2013-12-13  3:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13  3:00 Wang Weidong [this message]
2013-12-13 12:26 ` [PATCH v2] sctp: loading sctp when load sctp_probe Neil Horman
2013-12-13 14:41   ` Wang Weidong
2013-12-16  2:47   ` Wang Weidong
2013-12-16 13:48     ` Neil Horman
2013-12-16 14:14       ` Wang Weidong
2013-12-16 14:32         ` Neil Horman
2013-12-16 14:49           ` Wang Weidong
2013-12-16 15:04             ` Neil Horman
2013-12-17  1:11 ` David Miller

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=52AA783A.7090502@huawei.com \
    --to=wangweidong1@huawei$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=linux-sctp@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nhorman@tuxdriver$(echo .)com \
    --cc=vyasevich@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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