diff options
author | Ursula Braun <ubraun@linux.vnet.ibm.com> | 2017-09-21 03:16:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-21 18:31:03 -0400 |
commit | bfbedfd38378c1ad9df84469403d69c17b074b66 (patch) | |
tree | 4dda2a0ada224fb15e0634b81b3934aefa39d4ea /net | |
parent | 5bc11ddbdf7fc6681db5c3f9a92cdee0f19cee1e (diff) |
net/smc: terminate link group if out-of-sync is received
An out-of-sync condition can just be detected by the client.
If the server receives a CLC DECLINE message indicating an out-of-sync
condition for the link groups, the server must clean up the out-of-sync
link group.
There is no need for an extra third parameter in smc_clc_send_decline().
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/af_smc.c | 6 | ||||
-rw-r--r-- | net/smc/smc_clc.c | 10 | ||||
-rw-r--r-- | net/smc/smc_clc.h | 3 |
3 files changed, 8 insertions, 11 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 2e8d2dabac0c..745f145d4c4d 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c | |||
@@ -513,7 +513,7 @@ decline_rdma: | |||
513 | /* RDMA setup failed, switch back to TCP */ | 513 | /* RDMA setup failed, switch back to TCP */ |
514 | smc->use_fallback = true; | 514 | smc->use_fallback = true; |
515 | if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) { | 515 | if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) { |
516 | rc = smc_clc_send_decline(smc, reason_code, 0); | 516 | rc = smc_clc_send_decline(smc, reason_code); |
517 | if (rc < sizeof(struct smc_clc_msg_decline)) | 517 | if (rc < sizeof(struct smc_clc_msg_decline)) |
518 | goto out_err; | 518 | goto out_err; |
519 | } | 519 | } |
@@ -808,8 +808,6 @@ static void smc_listen_work(struct work_struct *work) | |||
808 | rc = local_contact; | 808 | rc = local_contact; |
809 | if (rc == -ENOMEM) | 809 | if (rc == -ENOMEM) |
810 | reason_code = SMC_CLC_DECL_MEM;/* insufficient memory*/ | 810 | reason_code = SMC_CLC_DECL_MEM;/* insufficient memory*/ |
811 | else if (rc == -ENOLINK) | ||
812 | reason_code = SMC_CLC_DECL_SYNCERR; /* synchr. error */ | ||
813 | goto decline_rdma; | 811 | goto decline_rdma; |
814 | } | 812 | } |
815 | link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK]; | 813 | link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK]; |
@@ -903,7 +901,7 @@ decline_rdma: | |||
903 | smc_conn_free(&new_smc->conn); | 901 | smc_conn_free(&new_smc->conn); |
904 | new_smc->use_fallback = true; | 902 | new_smc->use_fallback = true; |
905 | if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) { | 903 | if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) { |
906 | rc = smc_clc_send_decline(new_smc, reason_code, 0); | 904 | rc = smc_clc_send_decline(new_smc, reason_code); |
907 | if (rc < sizeof(struct smc_clc_msg_decline)) | 905 | if (rc < sizeof(struct smc_clc_msg_decline)) |
908 | goto out_err; | 906 | goto out_err; |
909 | } | 907 | } |
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index 3934913ab835..b7dd2743fb5c 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c | |||
@@ -95,9 +95,10 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, | |||
95 | } | 95 | } |
96 | if (clcm->type == SMC_CLC_DECLINE) { | 96 | if (clcm->type == SMC_CLC_DECLINE) { |
97 | reason_code = SMC_CLC_DECL_REPLY; | 97 | reason_code = SMC_CLC_DECL_REPLY; |
98 | if (ntohl(((struct smc_clc_msg_decline *)buf)->peer_diagnosis) | 98 | if (((struct smc_clc_msg_decline *)buf)->hdr.flag) { |
99 | == SMC_CLC_DECL_SYNCERR) | ||
100 | smc->conn.lgr->sync_err = true; | 99 | smc->conn.lgr->sync_err = true; |
100 | smc_lgr_terminate(smc->conn.lgr); | ||
101 | } | ||
101 | } | 102 | } |
102 | 103 | ||
103 | out: | 104 | out: |
@@ -105,8 +106,7 @@ out: | |||
105 | } | 106 | } |
106 | 107 | ||
107 | /* send CLC DECLINE message across internal TCP socket */ | 108 | /* send CLC DECLINE message across internal TCP socket */ |
108 | int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, | 109 | int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info) |
109 | u8 out_of_sync) | ||
110 | { | 110 | { |
111 | struct smc_clc_msg_decline dclc; | 111 | struct smc_clc_msg_decline dclc; |
112 | struct msghdr msg; | 112 | struct msghdr msg; |
@@ -118,7 +118,7 @@ int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, | |||
118 | dclc.hdr.type = SMC_CLC_DECLINE; | 118 | dclc.hdr.type = SMC_CLC_DECLINE; |
119 | dclc.hdr.length = htons(sizeof(struct smc_clc_msg_decline)); | 119 | dclc.hdr.length = htons(sizeof(struct smc_clc_msg_decline)); |
120 | dclc.hdr.version = SMC_CLC_V1; | 120 | dclc.hdr.version = SMC_CLC_V1; |
121 | dclc.hdr.flag = out_of_sync ? 1 : 0; | 121 | dclc.hdr.flag = (peer_diag_info == SMC_CLC_DECL_SYNCERR) ? 1 : 0; |
122 | memcpy(dclc.id_for_peer, local_systemid, sizeof(local_systemid)); | 122 | memcpy(dclc.id_for_peer, local_systemid, sizeof(local_systemid)); |
123 | dclc.peer_diagnosis = htonl(peer_diag_info); | 123 | dclc.peer_diagnosis = htonl(peer_diag_info); |
124 | memcpy(dclc.trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER)); | 124 | memcpy(dclc.trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER)); |
diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h index 13db8ce177c9..1c55414041d4 100644 --- a/net/smc/smc_clc.h +++ b/net/smc/smc_clc.h | |||
@@ -106,8 +106,7 @@ struct smc_ib_device; | |||
106 | 106 | ||
107 | int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, | 107 | int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, |
108 | u8 expected_type); | 108 | u8 expected_type); |
109 | int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, | 109 | int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info); |
110 | u8 out_of_sync); | ||
111 | int smc_clc_send_proposal(struct smc_sock *smc, struct smc_ib_device *smcibdev, | 110 | int smc_clc_send_proposal(struct smc_sock *smc, struct smc_ib_device *smcibdev, |
112 | u8 ibport); | 111 | u8 ibport); |
113 | int smc_clc_send_confirm(struct smc_sock *smc); | 112 | int smc_clc_send_confirm(struct smc_sock *smc); |