diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 53 | 
1 files changed, 29 insertions, 24 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index cd395c49e73..ae4138ebe7a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -2892,41 +2892,46 @@ glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,                  gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_DISCONNECT %d",                          peerinfo->state.state); -                peerinfo->connected = 0; -                  /*                    local glusterd (thinks that it) is the owner of the cluster                    lock and 'fails' the operation on the first disconnect from                    a peer.                  */ -                glusterd_get_lock_owner (&owner); -                if (!uuid_compare (conf->uuid, owner)) { -                        ret = glusterd_op_sm_inject_event (GD_OP_EVENT_START_UNLOCK, -                                                           NULL); + +                if (peerinfo->connected) { +                        glusterd_get_lock_owner (&owner); +                        if (!uuid_compare (conf->uuid, owner)) { +                                ret = glusterd_op_sm_inject_event +                                      (GD_OP_EVENT_START_UNLOCK, NULL); +                                if (ret) +                                        gf_log (this->name, GF_LOG_ERROR, +                                                "Unable to enqueue cluster " +                                                "unlock event"); +                                break; +                        } + +                        peer_uuid = GF_CALLOC (1, sizeof (*peer_uuid), +                                               gf_common_mt_char); +                        if (!peer_uuid) { +                                ret = -1; +                                break; +                        } + +                        uuid_copy (*peer_uuid, peerinfo->uuid); +                        ret = glusterd_op_sm_inject_event +                              (GD_OP_EVENT_LOCAL_UNLOCK_NO_RESP, peer_uuid);                          if (ret)                                  gf_log (this->name, GF_LOG_ERROR, "Unable" -                                        " to enqueue cluster unlock event"); -                        break; -                } - -                peer_uuid = GF_CALLOC (1, sizeof (*peer_uuid), gf_common_mt_char); -                if (!peer_uuid) { -                        ret = -1; -                        break; -                } +                                        " to enque local lock flush event."); -                uuid_copy (*peer_uuid, peerinfo->uuid); -                ret = glusterd_op_sm_inject_event (GD_OP_EVENT_LOCAL_UNLOCK_NO_RESP, -                                                   peer_uuid); -                if (ret) -                        gf_log (this->name, GF_LOG_ERROR, "Unable" -                                " to enque local lock flush event."); +                        //Inject friend disconnected here +                        if (peerinfo->state.state == GD_FRIEND_STATE_DEFAULT)  { +                                glusterd_friend_remove_notify (peerctx); +                        } -                //Inject friend disconnected here -                if (peerinfo->state.state == GD_FRIEND_STATE_DEFAULT)  { -                        glusterd_friend_remove_notify (peerctx);                  } +                peerinfo->connected = 0;                  //default_notify (this, GF_EVENT_CHILD_DOWN, NULL);                  break;          }  | 
