* [PATCH] sctp: loading sctp when load sctp_probe
@ 2013-12-12 12:32 Wang Weidong
2013-12-12 13:54 ` Neil Horman
0 siblings, 1 reply; 3+ messages in thread
From: Wang Weidong @ 2013-12-12 12:32 UTC (permalink / raw)
To: Vlad Yasevich, Neil Horman, David Miller; +Cc: linux-sctp, netdev
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.
Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
---
net/sctp/probe.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/net/sctp/probe.c b/net/sctp/probe.c
index 53c452e..cd9565a 100644
--- a/net/sctp/probe.c
+++ b/net/sctp/probe.c
@@ -182,6 +182,17 @@ 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) {
+ request_module("sctp");
+ ret = register_jprobe(&sctp_recv_probe);
+ }
+ return ret;
+}
+
static __init int sctpprobe_init(void)
{
int ret = -ENOMEM;
@@ -202,7 +213,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sctp: loading sctp when load sctp_probe
2013-12-12 12:32 [PATCH] sctp: loading sctp when load sctp_probe Wang Weidong
@ 2013-12-12 13:54 ` Neil Horman
2013-12-12 14:58 ` Wang Weidong
0 siblings, 1 reply; 3+ messages in thread
From: Neil Horman @ 2013-12-12 13:54 UTC (permalink / raw)
To: Wang Weidong; +Cc: Vlad Yasevich, David Miller, linux-sctp, netdev
On Thu, Dec 12, 2013 at 08:32:36PM +0800, Wang Weidong wrote:
> 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.
>
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
> ---
> net/sctp/probe.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/net/sctp/probe.c b/net/sctp/probe.c
> index 53c452e..cd9565a 100644
> --- a/net/sctp/probe.c
> +++ b/net/sctp/probe.c
> @@ -182,6 +182,17 @@ 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) {
> + request_module("sctp");
> + ret = register_jprobe(&sctp_recv_probe);
> + }
> + return ret;
> +}
> +
> static __init int sctpprobe_init(void)
> {
> int ret = -ENOMEM;
> @@ -202,7 +213,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
>
>
>
You need to check the return code of request_module. if sctp.ko doesn't exist,
you'll hit exactly the same problem.
You might consider also adding a MODULE_SOFTDEP macro in to the patch, so that
the dependency is clearly visible in userspace to modprobe.
Neil
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sctp: loading sctp when load sctp_probe
2013-12-12 13:54 ` Neil Horman
@ 2013-12-12 14:58 ` Wang Weidong
0 siblings, 0 replies; 3+ messages in thread
From: Wang Weidong @ 2013-12-12 14:58 UTC (permalink / raw)
To: Neil Horman; +Cc: Vlad Yasevich, David Miller, linux-sctp, netdev
From: Wang Weidong <wangweidong1@huawei.com>
On 2013/12/12 21:54, Neil Horman wrote:
> On Thu, Dec 12, 2013 at 08:32:36PM +0800, Wang Weidong wrote:
>> 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.
>>
>> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
>> ---
>> net/sctp/probe.c | 13 ++++++++++++-
>> 1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/sctp/probe.c b/net/sctp/probe.c
>> index 53c452e..cd9565a 100644
>> --- a/net/sctp/probe.c
>> +++ b/net/sctp/probe.c
>> @@ -182,6 +182,17 @@ 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) {
>> + request_module("sctp");
>> + ret = register_jprobe(&sctp_recv_probe);
>> + }
>> + return ret;
>> +}
>> +
>> static __init int sctpprobe_init(void)
>> {
>> int ret = -ENOMEM;
>> @@ -202,7 +213,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
>>
>>
>>
> You need to check the return code of request_module. if sctp.ko doesn't exist,
> you'll hit exactly the same problem.
>
> You might consider also adding a MODULE_SOFTDEP macro in to the patch, so that
> the dependency is clearly visible in userspace to modprobe.
>
> Neil
>
Thanks for your suggestions. I will fix it.
Regards.
Wang
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-12 14:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-12 12:32 [PATCH] sctp: loading sctp when load sctp_probe Wang Weidong
2013-12-12 13:54 ` Neil Horman
2013-12-12 14:58 ` Wang Weidong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).