* [PATCH net-next] dccp: add check request_moduls in setup_jprobe
@ 2013-12-17 12:30 Wang Weidong
2013-12-18 2:24 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-next] dccp: add check request_moduls in setup_jprobe) Gerrit Renker
0 siblings, 1 reply; 4+ messages in thread
From: Wang Weidong @ 2013-12-17 12:30 UTC (permalink / raw)
To: gerrit, David Miller; +Cc: dccp, netdev
when register_jprobe failed, we will try request_module. But some
time request_module will failed such as the dccp is not exist. so
check the request_module for avoiding do register_jprobe again.
Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
---
net/dccp/probe.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 4c6bdf9..53158d2 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -157,9 +157,12 @@ static __init int setup_jprobe(void)
int ret = register_jprobe(&dccp_send_probe);
if (ret) {
- request_module("dccp");
+ if (request_module("dccp"))
+ goto out;
ret = register_jprobe(&dccp_send_probe);
}
+
+out:
return ret;
}
--
1.7.12
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-next] dccp: add check request_moduls in setup_jprobe)
2013-12-17 12:30 [PATCH net-next] dccp: add check request_moduls in setup_jprobe Wang Weidong
@ 2013-12-18 2:24 ` Gerrit Renker
2013-12-18 2:38 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init Wang Weidong
0 siblings, 1 reply; 4+ messages in thread
From: Gerrit Renker @ 2013-12-18 2:24 UTC (permalink / raw)
To: Wang Weidong; +Cc: David Miller, dccp, netdev
Hi Wang,
thank you for the patch, please find refactored version below, changes are
(a) if request_module fails, return its error code instead of the previous ret,
(b) refactor code -- setup_jprobe becomes superfluous.
Please add your signed off if ok, since it is essentially your patch.
>>>>>>>>>>>>>>>>>>>>>>> Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dccp: catch failed request_module call in dccp_probe init
Check the return value of request_module during dccp_probe initialisation,
bail out if that call fails.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
net/dccp/probe.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -152,17 +152,6 @@ static const struct file_operations dccp
.llseek = noop_llseek,
};
-static __init int setup_jprobe(void)
-{
- int ret = register_jprobe(&dccp_send_probe);
-
- if (ret) {
- request_module("dccp");
- ret = register_jprobe(&dccp_send_probe);
- }
- return ret;
-}
-
static __init int dccpprobe_init(void)
{
int ret = -ENOMEM;
@@ -174,7 +163,13 @@ static __init int dccpprobe_init(void)
if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
goto err0;
- ret = setup_jprobe();
+ ret = register_jprobe(&dccp_send_probe);
+ if (ret) {
+ ret = request_module("dccp");
+ if (!ret)
+ ret = register_jprobe(&dccp_send_probe);
+ }
+
if (ret)
goto err1;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init
2013-12-18 2:24 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-next] dccp: add check request_moduls in setup_jprobe) Gerrit Renker
@ 2013-12-18 2:38 ` Wang Weidong
2013-12-20 0:26 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Wang Weidong @ 2013-12-18 2:38 UTC (permalink / raw)
To: Gerrit Renker; +Cc: David Miller, dccp, netdev
On 2013/12/18 10:24, Gerrit Renker wrote:
> Hi Wang,
>
> thank you for the patch, please find refactored version below, changes are
> (a) if request_module fails, return its error code instead of the previous ret,
> (b) refactor code -- setup_jprobe becomes superfluous.
>
> Please add your signed off if ok, since it is essentially your patch.
>
>>>>>>>>>>>>>>>>>>>>>>>> Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> dccp: catch failed request_module call in dccp_probe init
>
> Check the return value of request_module during dccp_probe initialisation,
> bail out if that call fails.
>
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
> net/dccp/probe.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> --- a/net/dccp/probe.c
> +++ b/net/dccp/probe.c
> @@ -152,17 +152,6 @@ static const struct file_operations dccp
> .llseek = noop_llseek,
> };
>
> -static __init int setup_jprobe(void)
> -{
> - int ret = register_jprobe(&dccp_send_probe);
> -
> - if (ret) {
> - request_module("dccp");
> - ret = register_jprobe(&dccp_send_probe);
> - }
> - return ret;
> -}
> -
> static __init int dccpprobe_init(void)
> {
> int ret = -ENOMEM;
> @@ -174,7 +163,13 @@ static __init int dccpprobe_init(void)
> if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
> goto err0;
>
> - ret = setup_jprobe();
> + ret = register_jprobe(&dccp_send_probe);
> + if (ret) {
> + ret = request_module("dccp");
> + if (!ret)
> + ret = register_jprobe(&dccp_send_probe);
> + }
> +
> if (ret)
> goto err1;
>
>
>
It is OK.
Thanks.
Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init
2013-12-18 2:38 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init Wang Weidong
@ 2013-12-20 0:26 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-12-20 0:26 UTC (permalink / raw)
To: wangweidong1; +Cc: gerrit, dccp, netdev
From: Wang Weidong <wangweidong1@huawei.com>
Date: Wed, 18 Dec 2013 10:38:36 +0800
> On 2013/12/18 10:24, Gerrit Renker wrote:
>> Hi Wang,
>>
>> thank you for the patch, please find refactored version below, changes are
>> (a) if request_module fails, return its error code instead of the previous ret,
>> (b) refactor code -- setup_jprobe becomes superfluous.
>>
>> Please add your signed off if ok, since it is essentially your patch.
>>
>>>>>>>>>>>>>>>>>>>>>>>>> Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>> dccp: catch failed request_module call in dccp_probe init
>>
>> Check the return value of request_module during dccp_probe initialisation,
>> bail out if that call fails.
>>
>> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
...
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-20 0:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17 12:30 [PATCH net-next] dccp: add check request_moduls in setup_jprobe Wang Weidong
2013-12-18 2:24 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-next] dccp: add check request_moduls in setup_jprobe) Gerrit Renker
2013-12-18 2:38 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init Wang Weidong
2013-12-20 0:26 ` David Miller
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).