Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Karsten Graul <kgraul@linux.ibm.com>
To: Wen Gu <guwen@linux.alibaba.com>, davem@davemloft.net, kuba@kernel.org
Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 3/3] net/smc: Resolve the race between SMC-R link access and clear
Date: Tue, 11 Jan 2022 09:40:05 +0100 [thread overview]
Message-ID: <8f13aa62-6360-8038-3041-86fd51b40a3e@linux.ibm.com> (raw)
In-Reply-To: <1641806784-93141-4-git-send-email-guwen@linux.alibaba.com>
On 10/01/2022 10:26, Wen Gu wrote:
> @@ -1226,15 +1245,23 @@ void smcr_link_clear(struct smc_link *lnk, bool log)
> smc_wr_free_link(lnk);
> smc_ib_destroy_queue_pair(lnk);
> smc_ib_dealloc_protection_domain(lnk);
> - smc_wr_free_link_mem(lnk);
> - smc_lgr_put(lnk->lgr); /* lgr_hold in smcr_link_init() */
> smc_ibdev_cnt_dec(lnk);
> put_device(&lnk->smcibdev->ibdev->dev);
> smcibdev = lnk->smcibdev;
> - memset(lnk, 0, sizeof(struct smc_link));
> - lnk->state = SMC_LNK_UNUSED;
> if (!atomic_dec_return(&smcibdev->lnk_cnt))
> wake_up(&smcibdev->lnks_deleted);
Same here, waiter should not be woken up until the link memory is actually freed.
> + smcr_link_put(lnk); /* theoretically last link_put */
> +}
> +
> +void smcr_link_hold(struct smc_link *lnk)
> +{
> + refcount_inc(&lnk->refcnt);
> +}
> +
> +void smcr_link_put(struct smc_link *lnk)
> +{
> + if (refcount_dec_and_test(&lnk->refcnt))
> + __smcr_link_clear(lnk);
> }
next prev parent reply other threads:[~2022-01-11 8:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 9:26 [PATCH net 0/3] net/smc: Fixes for race in smc link group termination Wen Gu
2022-01-10 9:26 ` [PATCH net 1/3] net/smc: Resolve the race between link group access and termination Wen Gu
2022-01-10 12:25 ` Karsten Graul
2022-01-10 13:56 ` Wen Gu
2022-01-11 8:23 ` Karsten Graul
2022-01-11 15:36 ` Wen Gu
2022-01-11 15:46 ` Karsten Graul
2022-01-11 15:51 ` Wen Gu
2022-01-10 9:26 ` [PATCH net 2/3] net/smc: Introduce a new conn->lgr validity check helper Wen Gu
2022-01-10 9:26 ` [PATCH net 3/3] net/smc: Resolve the race between SMC-R link access and clear Wen Gu
2022-01-11 8:40 ` Karsten Graul [this message]
2022-01-11 15:49 ` Wen Gu
2022-01-11 16:02 ` Karsten Graul
2022-01-11 16:44 ` Wen Gu
2022-01-11 17:42 ` Karsten Graul
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=8f13aa62-6360-8038-3041-86fd51b40a3e@linux.ibm.com \
--to=kgraul@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=guwen@linux.alibaba.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--subject='Re: [PATCH net 3/3] net/smc: Resolve the race between SMC-R link access and clear' \
/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
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).