Skip to content

Commit 8fc002b

Browse files
karstengrdavem330
authored andcommitted
net/smc: move code to clear the conn->lgr field
The lgr field of an smc_connection is set in smc_conn_create() and should be cleared in smc_conn_free() for consistency reasons, so move the responsible code. Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 72a36a8 commit 8fc002b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/smc/smc_core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ static void __smc_lgr_unregister_conn(struct smc_connection *conn)
118118
rb_erase(&conn->alert_node, &lgr->conns_all);
119119
lgr->conns_num--;
120120
conn->alert_token_local = 0;
121-
conn->lgr = NULL;
122121
sock_put(&smc->sk); /* sock_hold in smc_lgr_register_conn() */
123122
}
124123

@@ -331,8 +330,9 @@ void smc_conn_free(struct smc_connection *conn)
331330
} else {
332331
smc_cdc_tx_dismiss_slots(conn);
333332
}
334-
smc_lgr_unregister_conn(conn); /* unsets conn->lgr */
333+
smc_lgr_unregister_conn(conn);
335334
smc_buf_unuse(conn, lgr); /* allow buffer reuse */
335+
conn->lgr = NULL;
336336

337337
if (!lgr->conns_num)
338338
smc_lgr_schedule_free_work(lgr);
@@ -462,6 +462,7 @@ static void __smc_lgr_terminate(struct smc_link_group *lgr)
462462
sock_hold(&smc->sk); /* sock_put in close work */
463463
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
464464
__smc_lgr_unregister_conn(conn);
465+
conn->lgr = NULL;
465466
write_unlock_bh(&lgr->conns_lock);
466467
if (!schedule_work(&conn->close_work))
467468
sock_put(&smc->sk);

0 commit comments

Comments
 (0)