summaryrefslogtreecommitdiff
path: root/net/smc/smc_core.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-05-04 16:58:56 +0300
committerDavid S. Miller <davem@davemloft.net>2018-05-04 16:58:56 +0300
commita7b15ab887e5b8e9803136b5a4a0008d7a3dea86 (patch)
treeca5342d29badb2a3cce2a353b786c8ab4a993c1e /net/smc/smc_core.c
parentb05f03b232ab4f8f173eeae291a4c9cd662a6676 (diff)
parent1504269814263c9676b4605a6a91e14dc6ceac21 (diff)
downloadlinux-a7b15ab887e5b8e9803136b5a4a0008d7a3dea86.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Overlapping changes in selftests Makefile. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc_core.c')
-rw-r--r--net/smc/smc_core.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 1f3ea62fac5c..79aa7d312d6b 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -32,6 +32,9 @@
static u32 smc_lgr_num; /* unique link group number */
+static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk,
+ bool is_rmb);
+
static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
{
/* client link group creation always follows the server link group
@@ -234,9 +237,22 @@ static void smc_buf_unuse(struct smc_connection *conn)
conn->sndbuf_size = 0;
}
if (conn->rmb_desc) {
- conn->rmb_desc->reused = true;
- conn->rmb_desc->used = 0;
- conn->rmbe_size = 0;
+ if (!conn->rmb_desc->regerr) {
+ conn->rmb_desc->reused = 1;
+ conn->rmb_desc->used = 0;
+ conn->rmbe_size = 0;
+ } else {
+ /* buf registration failed, reuse not possible */
+ struct smc_link_group *lgr = conn->lgr;
+ struct smc_link *lnk;
+
+ write_lock_bh(&lgr->rmbs_lock);
+ list_del(&conn->rmb_desc->list);
+ write_unlock_bh(&lgr->rmbs_lock);
+
+ lnk = &lgr->lnk[SMC_SINGLE_LINK];
+ smc_buf_free(conn->rmb_desc, lnk, true);
+ }
}
}