public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Wenjia Zhang <wenjia@linux.ibm.com>
To: Wen Gu <guwen@linux.alibaba.com>, kgraul@linux.ibm.com
Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/smc: Stop the CLC flow if no link to map buffers on
Date: Thu, 22 Sep 2022 15:07:38 +0200	[thread overview]
Message-ID: <2f6ba289-050a-f77b-3cd2-694317f070bb@linux.ibm.com> (raw)
In-Reply-To: <cd996f1e-5ebf-c253-6a87-ce0e055b84c8@linux.alibaba.com>



On 22.09.22 10:29, Wen Gu wrote:
> 
> 
> On 2022/9/20 14:43, Wen Gu wrote:
> 
>> There might be a potential race between SMC-R buffer map and
>> link group termination.
>>
>> smc_smcr_terminate_all()     | smc_connect_rdma()
>> --------------------------------------------------------------
>>                               | smc_conn_create()
>> for links in smcibdev        |
>>          schedule links down  |
>>                               | smc_buf_create()
>>                               |  \- smcr_buf_map_usable_links()
>>                               |      \- no usable links found,
>>                               |         (rmb->mr = NULL)
>>                               |
>>                               | smc_clc_send_confirm()
>>                               |  \- access conn->rmb_desc->mr[]->rkey
>>                               |     (panic)
>>
>> During reboot and IB device module remove, all links will be set
>> down and no usable links remain in link groups. In such situation
>> smcr_buf_map_usable_links() should return an error and stop the
>> CLC flow accessing to uninitialized mr.
>>
>> Fixes: b9247544c1bc ("net/smc: convert static link ID instances to 
>> support multiple links")
>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>> ---
>>   net/smc/smc_core.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
>> index ebf56cd..df89c2e 100644
>> --- a/net/smc/smc_core.c
>> +++ b/net/smc/smc_core.c
>> @@ -2239,7 +2239,7 @@ static struct smc_buf_desc 
>> *smcr_new_buf_create(struct smc_link_group *lgr,
>>   static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
>>                        struct smc_buf_desc *buf_desc, bool is_rmb)
>>   {
>> -    int i, rc = 0;
>> +    int i, rc = 0, cnt = 0;
>>       /* protect against parallel link reconfiguration */
>>       mutex_lock(&lgr->llc_conf_mutex);
>> @@ -2252,9 +2252,12 @@ static int smcr_buf_map_usable_links(struct 
>> smc_link_group *lgr,
>>               rc = -ENOMEM;
>>               goto out;
>>           }
>> +        cnt++;
>>       }
>>   out:
>>       mutex_unlock(&lgr->llc_conf_mutex);
>> +    if (!rc && !cnt)
>> +        rc = -EINVAL;
>>       return rc;
>>   }
> 
> Any comments or reviews are welcome and appreciated.
> 
> Thanks,
> Wen Gu

Sorry for the late answer!
Good catch! Thank you!

Acked-by: Wenjia Zhang <wenjia@linux.ibm.com>

  reply	other threads:[~2022-09-22 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  6:43 [PATCH net] net/smc: Stop the CLC flow if no link to map buffers on Wen Gu
2022-09-22  8:29 ` Wen Gu
2022-09-22 13:07   ` Wenjia Zhang [this message]
2022-09-22 11:00 ` patchwork-bot+netdevbpf

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=2f6ba289-050a-f77b-3cd2-694317f070bb@linux.ibm.com \
    --to=wenjia@linux.ibm.com \
    --cc=guwen@linux.alibaba.com \
    --cc=kgraul@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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