Avoid to run the processing in smc_lgr_terminate() more than once,
remember when the link group termination is triggered.
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
        if (clcm->type == SMC_CLC_DECLINE) {
                reason_code = SMC_CLC_DECL_REPLY;
                if (((struct smc_clc_msg_decline *)buf)->hdr.flag) {
-                       smc->conn.lgr->sync_err = true;
+                       smc->conn.lgr->sync_err = 1;
                        smc_lgr_terminate(smc->conn.lgr);
                }
        }
 
                goto out;
        }
        lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT;
-       lgr->sync_err = false;
+       lgr->sync_err = 0;
        memcpy(lgr->peer_systemid, peer_systemid, SMC_SYSTEMID_LEN);
        lgr->vlan_id = vlan_id;
        rwlock_init(&lgr->sndbufs_lock);
        struct smc_sock *smc;
        struct rb_node *node;
 
+       if (lgr->terminating)
+               return; /* lgr already terminating */
+       lgr->terminating = 1;
        smc_lgr_forget(lgr);
        smc_llc_link_inactive(&lgr->lnk[SMC_SINGLE_LINK]);
 
 
 
        u8                      id[SMC_LGR_ID_SIZE];    /* unique lgr id */
        struct delayed_work     free_work;      /* delayed freeing of an lgr */
-       bool                    sync_err;       /* lgr no longer fits to peer */
+       u8                      sync_err : 1;   /* lgr no longer fits to peer */
+       u8                      terminating : 1;/* lgr is terminating */
 };
 
 /* Find the connection associated with the given alert token in the link group.