Skip to content

Commit c5bf605

Browse files
D. Wythedavem330
authored andcommitted
net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc
This patch re-fix the issues mentioned by commit 22a825c ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()"). Blocking sending message do solve the issues though, but it also prevents the peer to receive the final message. Besides, in logic, whether the sndbuf_desc is NULL or not have no impact on the processing of cdc message sending. Hence that, this patch allows the cdc message sending but to check the sndbuf_desc with care in smc_cdc_tx_handler(). Fixes: 22a825c ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()") Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5211c97 commit c5bf605

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

net/smc/smc_cdc.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd,
2828
{
2929
struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd;
3030
struct smc_connection *conn = cdcpend->conn;
31+
struct smc_buf_desc *sndbuf_desc;
3132
struct smc_sock *smc;
3233
int diff;
3334

35+
sndbuf_desc = conn->sndbuf_desc;
3436
smc = container_of(conn, struct smc_sock, conn);
3537
bh_lock_sock(&smc->sk);
36-
if (!wc_status) {
37-
diff = smc_curs_diff(cdcpend->conn->sndbuf_desc->len,
38+
if (!wc_status && sndbuf_desc) {
39+
diff = smc_curs_diff(sndbuf_desc->len,
3840
&cdcpend->conn->tx_curs_fin,
3941
&cdcpend->cursor);
4042
/* sndbuf_space is decreased in smc_sendmsg */
@@ -114,9 +116,6 @@ int smc_cdc_msg_send(struct smc_connection *conn,
114116
union smc_host_cursor cfed;
115117
int rc;
116118

117-
if (unlikely(!READ_ONCE(conn->sndbuf_desc)))
118-
return -ENOBUFS;
119-
120119
smc_cdc_add_pending_send(conn, pend);
121120

122121
conn->tx_cdc_seq++;

0 commit comments

Comments
 (0)