net/smc: Correct smc link connection counter in case of smc client

SMC clients may be assigned to a different link after the initial
connection between two peers was established. In such a case,
the connection counter was not correctly set.

Update the connection counter correctly when a smc client connection
is assigned to a different smc link.

Fixes: 07d51580ff ("net/smc: Add connection counters for links")
Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
Tested-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Guvenc Gulce 2021-08-09 11:05:57 +02:00 committed by David S. Miller
parent 8f3d65c166
commit 64513d269e
3 changed files with 5 additions and 3 deletions

View File

@ -795,7 +795,7 @@ static int smc_connect_rdma(struct smc_sock *smc,
reason_code = SMC_CLC_DECL_NOSRVLINK; reason_code = SMC_CLC_DECL_NOSRVLINK;
goto connect_abort; goto connect_abort;
} }
smc->conn.lnk = link; smc_switch_link_and_count(&smc->conn, link);
} }
/* create send buffer and rmb */ /* create send buffer and rmb */

View File

@ -917,8 +917,8 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
return rc; return rc;
} }
static void smc_switch_link_and_count(struct smc_connection *conn, void smc_switch_link_and_count(struct smc_connection *conn,
struct smc_link *to_lnk) struct smc_link *to_lnk)
{ {
atomic_dec(&conn->lnk->conn_cnt); atomic_dec(&conn->lnk->conn_cnt);
conn->lnk = to_lnk; conn->lnk = to_lnk;

View File

@ -446,6 +446,8 @@ void smc_core_exit(void);
int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk, int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
u8 link_idx, struct smc_init_info *ini); u8 link_idx, struct smc_init_info *ini);
void smcr_link_clear(struct smc_link *lnk, bool log); void smcr_link_clear(struct smc_link *lnk, bool log);
void smc_switch_link_and_count(struct smc_connection *conn,
struct smc_link *to_lnk);
int smcr_buf_map_lgr(struct smc_link *lnk); int smcr_buf_map_lgr(struct smc_link *lnk);
int smcr_buf_reg_lgr(struct smc_link *lnk); int smcr_buf_reg_lgr(struct smc_link *lnk);
void smcr_lgr_set_type(struct smc_link_group *lgr, enum smc_lgr_type new_type); void smcr_lgr_set_type(struct smc_link_group *lgr, enum smc_lgr_type new_type);