On 10/01/2022 10:26, Wen Gu wrote:
We encountered some crashes caused by the race between the access
and the termination of link groups.
@@ -1120,8 +1122,22 @@ void smc_conn_free(struct smc_connection *conn)
{
struct smc_link_group *lgr = conn->lgr;
- if (!lgr)
+ if (!lgr || conn->freed)
+ /* The connection has never been registered in a
+ * link group, or has already been freed.
+ *
+ * Check to ensure that the refcnt of link group
+ * won't be put incorrectly.
I would delete the second sentence here, its obvious enough.
+ */
return;
+
+ conn->freed = 1;
+ if (!conn->alert_token_local)
+ /* The connection was registered in a link group
+ * defore, but now it is unregistered from it.
'before' ... But would maybe the following be more exact:
'Connection already unregistered from link group.'
We still review the patches...