2022-08-29 15:32:52

by Yacan Liu

[permalink] [raw]
Subject: [PATCH net] net/smc: Remove redundant refcount increase

From: liuyacan <[email protected]>

For passive connections, the refcount increment has been done in
smc_clcsock_accept()-->smc_sock_alloc().

Fixes: 3b2dec2603d5("net/smc: restructure client and server code in af_smc")
Signed-off-by: liuyacan <[email protected]>
---
net/smc/af_smc.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 79c1318af..0939cc3b9 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1855,7 +1855,6 @@ static void smc_listen_out_connected(struct smc_sock *new_smc)
{
struct sock *newsmcsk = &new_smc->sk;

- sk_refcnt_debug_inc(newsmcsk);
if (newsmcsk->sk_state == SMC_INIT)
newsmcsk->sk_state = SMC_ACTIVE;

--
2.20.1


2022-08-29 16:17:50

by Tony Lu

[permalink] [raw]
Subject: Re: [PATCH net] net/smc: Remove redundant refcount increase

On Mon, Aug 29, 2022 at 10:53:29PM +0800, [email protected] wrote:
> From: liuyacan <[email protected]>
>
> For passive connections, the refcount increment has been done in
> smc_clcsock_accept()-->smc_sock_alloc().
>
> Fixes: 3b2dec2603d5("net/smc: restructure client and server code in af_smc")
> Signed-off-by: liuyacan <[email protected]>
> ---
> net/smc/af_smc.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 79c1318af..0939cc3b9 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1855,7 +1855,6 @@ static void smc_listen_out_connected(struct smc_sock *new_smc)
> {
> struct sock *newsmcsk = &new_smc->sk;
>
> - sk_refcnt_debug_inc(newsmcsk);
> if (newsmcsk->sk_state == SMC_INIT)

Thank you for the fixes, I will test it in the CI.

Thanks.
Tony Lu

2022-08-30 15:48:05

by Yacan Liu

[permalink] [raw]
Subject: [PATCH net v2] net/smc: Remove redundant refcount increase

From: Yacan Liu <[email protected]>

For passive connections, the refcount increment has been done in
smc_clcsock_accept()-->smc_sock_alloc().

Fixes: 3b2dec2603d5 ("net/smc: restructure client and server code in af_smc")
Signed-off-by: Yacan Liu <[email protected]>

---
Change in v2:
-- Tune commit message
---
net/smc/af_smc.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 79c1318af..0939cc3b9 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1855,7 +1855,6 @@ static void smc_listen_out_connected(struct smc_sock *new_smc)
{
struct sock *newsmcsk = &new_smc->sk;

- sk_refcnt_debug_inc(newsmcsk);
if (newsmcsk->sk_state == SMC_INIT)
newsmcsk->sk_state = SMC_ACTIVE;

--
2.20.1

2022-09-01 06:15:48

by Wenjia Zhang

[permalink] [raw]
Subject: Re: [PATCH net] net/smc: Remove redundant refcount increase



On 29.08.22 16:53, [email protected] wrote:
> From: liuyacan <[email protected]>
>
> For passive connections, the refcount increment has been done in
> smc_clcsock_accept()-->smc_sock_alloc().
>
> Fixes: 3b2dec2603d5("net/smc: restructure client and server code in af_smc")
> Signed-off-by: liuyacan <[email protected]>
> ---
> net/smc/af_smc.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 79c1318af..0939cc3b9 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1855,7 +1855,6 @@ static void smc_listen_out_connected(struct smc_sock *new_smc)
> {
> struct sock *newsmcsk = &new_smc->sk;
>
> - sk_refcnt_debug_inc(newsmcsk);
> if (newsmcsk->sk_state == SMC_INIT)
> newsmcsk->sk_state = SMC_ACTIVE;
>
Good catch! Thank you for the patch! But fixes should go to the net-next
tree.

2022-09-01 07:44:37

by Tony Lu

[permalink] [raw]
Subject: Re: [PATCH net v2] net/smc: Remove redundant refcount increase

On Tue, Aug 30, 2022 at 11:23:14PM +0800, [email protected] wrote:
> From: Yacan Liu <[email protected]>
>
> For passive connections, the refcount increment has been done in
> smc_clcsock_accept()-->smc_sock_alloc().
>
> Fixes: 3b2dec2603d5 ("net/smc: restructure client and server code in af_smc")
> Signed-off-by: Yacan Liu <[email protected]>
>
> ---
> Change in v2:
> -- Tune commit message
> ---
> net/smc/af_smc.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 79c1318af..0939cc3b9 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1855,7 +1855,6 @@ static void smc_listen_out_connected(struct smc_sock *new_smc)
> {
> struct sock *newsmcsk = &new_smc->sk;
>
> - sk_refcnt_debug_inc(newsmcsk);
> if (newsmcsk->sk_state == SMC_INIT)
> newsmcsk->sk_state = SMC_ACTIVE;
>

Thanks for this fixes. I dig into this sk_refcnt_debug_* facility. It
seems this is a very old debug methods and doesn't help a lot for sock
leak issue. Maybe there is another method to help track this issue?

For this patch, It looks good for me and tested in our environment.

Reviewed-by: Tony Lu <[email protected]>

Cheers,
Tony Lu

2022-09-01 08:42:52

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net v2] net/smc: Remove redundant refcount increase

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

On Tue, 30 Aug 2022 23:23:14 +0800 you wrote:
> From: Yacan Liu <[email protected]>
>
> For passive connections, the refcount increment has been done in
> smc_clcsock_accept()-->smc_sock_alloc().
>
> Fixes: 3b2dec2603d5 ("net/smc: restructure client and server code in af_smc")
> Signed-off-by: Yacan Liu <[email protected]>
>
> [...]

Here is the summary with links:
- [net,v2] net/smc: Remove redundant refcount increase
https://git.kernel.org/netdev/net/c/a8424a9b4522

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html