public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Karsten Graul <kgraul@linux.ibm.com>
To: Tony Lu <tonylu@linux.alibaba.com>
Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
	linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH net 2/2] net/smc: Don't call clcsock shutdown twice when smc shutdown
Date: Thu, 25 Nov 2021 12:02:06 +0100	[thread overview]
Message-ID: <77c1be59-5e55-80f1-4fc6-16fb65846b7e@linux.ibm.com> (raw)
In-Reply-To: <20211125061932.74874-3-tonylu@linux.alibaba.com>

On 25/11/2021 07:19, Tony Lu wrote:
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 4b62c925a13e..7b04cb4d15f4 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -2373,6 +2373,7 @@ static int smc_shutdown(struct socket *sock, int how)
>  	struct smc_sock *smc;
>  	int rc = -EINVAL;
>  	int rc1 = 0;
> +	int old_state;

Reverse Christmas tree formatting, please.

>  
>  	smc = smc_sk(sk);
>  
> @@ -2398,7 +2399,12 @@ static int smc_shutdown(struct socket *sock, int how)
>  	}
>  	switch (how) {
>  	case SHUT_RDWR:		/* shutdown in both directions */
> +		old_state = sk->sk_state;
>  		rc = smc_close_active(smc);
> +		if (old_state == SMC_ACTIVE &&
> +		    sk->sk_state == SMC_PEERCLOSEWAIT1)
> +			goto out_no_shutdown;
> +

I would prefer a new "bool do_shutdown" instead of a goto for this skip
of the shutdown. What do you think?

>  		break;
>  	case SHUT_WR:
>  		rc = smc_close_shutdown_write(smc);
> @@ -2410,6 +2416,8 @@ static int smc_shutdown(struct socket *sock, int how)
>  	}
>  	if (smc->clcsock)
>  		rc1 = kernel_sock_shutdown(smc->clcsock, how);
> +
> +out_no_shutdown:
>  	/* map sock_shutdown_cmd constants to sk_shutdown value range */
>  	sk->sk_shutdown |= how + 1;
>  
> 

-- 
Karsten

  reply	other threads:[~2021-11-25 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  6:19 [PATCH net 0/2] Fixes for clcsock shutdown behaviors Tony Lu
2021-11-25  6:19 ` [PATCH net 1/2] net/smc: Keep smc_close_final rc during active close Tony Lu
2021-11-25 10:51   ` Karsten Graul
2021-11-25  6:19 ` [PATCH net 2/2] net/smc: Don't call clcsock shutdown twice when smc shutdown Tony Lu
2021-11-25 11:02   ` Karsten Graul [this message]
2021-11-25 12:41     ` Tony Lu

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=77c1be59-5e55-80f1-4fc6-16fb65846b7e@linux.ibm.com \
    --to=kgraul@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tonylu@linux.alibaba.com \
    /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