Message ID | 1698810177-69740-3-git-send-email-alibuda@linux.alibaba.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | bugfixs for smc | expand |
On Wed, Nov 01, 2023 at 11:42:56AM +0800, D. Wythe wrote: >From: "D. Wythe" <alibuda@linux.alibaba.com> > >This patch re-fix the issues memtianed by commit 22a825c541d7 memtianed -> mentioned ? >("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 allow the cdc message sending but to check the allows >sndbuf_desc with care in smc_cdc_tx_handler(). > >Fixes: 22a825c541d7 ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()") >Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> >Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> >--- > net/smc/smc_cdc.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > >diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c >index 01bdb79..3c06625 100644 >--- a/net/smc/smc_cdc.c >+++ b/net/smc/smc_cdc.c >@@ -28,13 +28,15 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd, > { > struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd; > struct smc_connection *conn = cdcpend->conn; >+ struct smc_buf_desc *sndbuf_desc; > struct smc_sock *smc; > int diff; > >+ sndbuf_desc = conn->sndbuf_desc; > smc = container_of(conn, struct smc_sock, conn); > bh_lock_sock(&smc->sk); >- if (!wc_status) { >- diff = smc_curs_diff(cdcpend->conn->sndbuf_desc->len, >+ if (!wc_status && sndbuf_desc) { >+ diff = smc_curs_diff(sndbuf_desc->len, > &cdcpend->conn->tx_curs_fin, > &cdcpend->cursor); > /* sndbuf_space is decreased in smc_sendmsg */ >@@ -114,9 +116,6 @@ int smc_cdc_msg_send(struct smc_connection *conn, > union smc_host_cursor cfed; > int rc; > >- if (unlikely(!READ_ONCE(conn->sndbuf_desc))) >- return -ENOBUFS; >- > smc_cdc_add_pending_send(conn, pend); > > conn->tx_cdc_seq++; >-- >1.8.3.1
On 11/1/23 4:19 PM, Dust Li wrote: > On Wed, Nov 01, 2023 at 11:42:56AM +0800, D. Wythe wrote: >> From: "D. Wythe" <alibuda@linux.alibaba.com> >> >> This patch re-fix the issues memtianed by commit 22a825c541d7 > memtianed -> mentioned ? > >> ("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 allow the cdc message sending but to check the > allows > >> sndbuf_desc with care in smc_cdc_tx_handler(). >> >> Fixes: 22a825c541d7 ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()") >> Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> >> Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com> Thanks for that. I will fix them in next version. > Reviewed-by: Dust Li <dust.li@linux.alibaba.com> >> --- >> net/smc/smc_cdc.c | 9 ++++----- >> 1 file changed, 4 insertions(+), 5 deletions(-) >> >> diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c >> index 01bdb79..3c06625 100644 >> --- a/net/smc/smc_cdc.c >> +++ b/net/smc/smc_cdc.c >> @@ -28,13 +28,15 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd, >> { >> struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd; >> struct smc_connection *conn = cdcpend->conn; >> + struct smc_buf_desc *sndbuf_desc; >> struct smc_sock *smc; >> int diff; >> >> + sndbuf_desc = conn->sndbuf_desc; >> smc = container_of(conn, struct smc_sock, conn); >> bh_lock_sock(&smc->sk); >> - if (!wc_status) { >> - diff = smc_curs_diff(cdcpend->conn->sndbuf_desc->len, >> + if (!wc_status && sndbuf_desc) { >> + diff = smc_curs_diff(sndbuf_desc->len, >> &cdcpend->conn->tx_curs_fin, >> &cdcpend->cursor); >> /* sndbuf_space is decreased in smc_sendmsg */ >> @@ -114,9 +116,6 @@ int smc_cdc_msg_send(struct smc_connection *conn, >> union smc_host_cursor cfed; >> int rc; >> >> - if (unlikely(!READ_ONCE(conn->sndbuf_desc))) >> - return -ENOBUFS; >> - >> smc_cdc_add_pending_send(conn, pend); >> >> conn->tx_cdc_seq++; >> -- >> 1.8.3.1
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c index 01bdb79..3c06625 100644 --- a/net/smc/smc_cdc.c +++ b/net/smc/smc_cdc.c @@ -28,13 +28,15 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd, { struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd; struct smc_connection *conn = cdcpend->conn; + struct smc_buf_desc *sndbuf_desc; struct smc_sock *smc; int diff; + sndbuf_desc = conn->sndbuf_desc; smc = container_of(conn, struct smc_sock, conn); bh_lock_sock(&smc->sk); - if (!wc_status) { - diff = smc_curs_diff(cdcpend->conn->sndbuf_desc->len, + if (!wc_status && sndbuf_desc) { + diff = smc_curs_diff(sndbuf_desc->len, &cdcpend->conn->tx_curs_fin, &cdcpend->cursor); /* sndbuf_space is decreased in smc_sendmsg */ @@ -114,9 +116,6 @@ int smc_cdc_msg_send(struct smc_connection *conn, union smc_host_cursor cfed; int rc; - if (unlikely(!READ_ONCE(conn->sndbuf_desc))) - return -ENOBUFS; - smc_cdc_add_pending_send(conn, pend); conn->tx_cdc_seq++;