diff options
-rw-r--r-- | rpc/block_svc_routines.c | 29 | ||||
-rw-r--r-- | utils/utils.h | 14 |
2 files changed, 31 insertions, 12 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c index 175372a..16437c0 100644 --- a/rpc/block_svc_routines.c +++ b/rpc/block_svc_routines.c @@ -52,6 +52,7 @@ glusterBlockCallRPC_1(char *host, void *cobj, CLIENT *clnt = NULL; int ret = -1; int sockfd; + int errsv = 0; blockResponse *reply = NULL; struct hostent *server; struct sockaddr_in sain = {0, }; @@ -78,6 +79,7 @@ glusterBlockCallRPC_1(char *host, void *cobj, if (connect(sockfd, (struct sockaddr *) &sain, sizeof(sain)) < 0) { LOG("mgmt", GB_LOG_ERROR, "connect on %s failed (%s)", host, strerror (errno)); + errsv = errno; goto out; } @@ -129,6 +131,10 @@ glusterBlockCallRPC_1(char *host, void *cobj, close(sockfd); } + if (errsv) { + errno = errsv; + } + return ret; } @@ -215,6 +221,12 @@ glusterBlockCreateRemote(void *data) ret = glusterBlockCallRPC_1(args->addr, &cobj, CREATE_SRV, &args->reply); if (ret) { + if (errno == ENETUNREACH || errno == ECONNREFUSED || errno == ETIMEDOUT) { + LOG("mgmt", GB_LOG_ERROR, "%s hence %s for block %s on" + "host %s volume %s", strerror(errno), FAILED_REMOTE_CREATE, + cobj.block_name, args->addr, args->volume); + goto out; + } GB_METAUPDATE_OR_GOTO(lock, args->glfs, cobj.block_name, cobj.volume, ret, out, "%s: CONFIGFAIL\n", args->addr); LOG("mgmt", GB_LOG_ERROR, "%s for block %s on host %s volume %s", @@ -312,6 +324,12 @@ glusterBlockDeleteRemote(void *data) ret, out, "%s: CLEANUPINPROGRESS\n", args->addr); ret = glusterBlockCallRPC_1(args->addr, &dobj, DELETE_SRV, &args->reply); if (ret) { + if (errno == ENETUNREACH || errno == ECONNREFUSED || errno == ETIMEDOUT) { + LOG("mgmt", GB_LOG_ERROR, "%s hence %s for block %s on" + "host %s volume %s", strerror(errno), FAILED_REMOTE_DELETE, + dobj.block_name, args->addr, args->volume); + goto out; + } GB_METAUPDATE_OR_GOTO(lock, args->glfs, dobj.block_name, args->volume, ret, out, "%s: CLEANUPFAIL\n", args->addr); LOG("mgmt", GB_LOG_ERROR, "%s for block %s on host %s volume %s", @@ -357,10 +375,9 @@ glusterBlockDeleteRemoteAsync(MetaInfo *info, for (i = 0, count = 0; i < info->nhosts; i++) { switch (blockMetaStatusEnumParse(info->list[i]->status)) { - case GB_CLEANUP_INPROGRES: + case GB_CLEANUP_INPROGRESS: case GB_CLEANUP_FAIL: case GB_CONFIG_FAIL: - case GB_CONFIG_INPROGRESS: args[count].glfs = glfs; args[count].obj = (void *)dobj; args[count].volume = info->volume; @@ -439,10 +456,9 @@ glusterBlockCleanUp(struct glfs *glfs, char *blockname, for (i = 0; i < info->nhosts; i++) { switch (blockMetaStatusEnumParse(info->list[i]->status)) { - case GB_CLEANUP_INPROGRES: + case GB_CLEANUP_INPROGRESS: case GB_CLEANUP_FAIL: case GB_CONFIG_FAIL: - case GB_CONFIG_INPROGRESS: count++; break; } @@ -475,8 +491,11 @@ glusterBlockCleanUp(struct glfs *glfs, char *blockname, } for (i = 0; i < info->nhosts; i++) { - if (blockMetaStatusEnumParse(info->list[i]->status) == GB_CLEANUP_SUCCESS) { + switch (blockMetaStatusEnumParse(info->list[i]->status)) { + case GB_CONFIG_INPROGRESS: /* un touched */ + case GB_CLEANUP_SUCCESS: cleanupsuccess++; + break; } } diff --git a/utils/utils.h b/utils/utils.h index 0e6ed9b..77a6de0 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -301,12 +301,12 @@ static const char *const MetakeyLookup[] = { }; typedef enum MetaStatus { - GB_CONFIG_SUCCESS = 0, - GB_CONFIG_FAIL = 1, - GB_CONFIG_INPROGRESS = 2, - GB_CLEANUP_SUCCESS = 3, - GB_CLEANUP_FAIL = 4, - GB_CLEANUP_INPROGRES = 5, + GB_CONFIG_SUCCESS = 0, + GB_CONFIG_FAIL = 1, + GB_CONFIG_INPROGRESS = 2, + GB_CLEANUP_SUCCESS = 3, + GB_CLEANUP_FAIL = 4, + GB_CLEANUP_INPROGRESS = 5, GB_METASTATUS_MAX } MetaStatus; @@ -315,7 +315,7 @@ static const char *const MetaStatusLookup[] = { [GB_CONFIG_SUCCESS] = "CONFIGSUCCESS", [GB_CONFIG_FAIL] = "CONFIGFAIL", [GB_CONFIG_INPROGRESS] = "CONFIGINPROGRESS", - [GB_CLEANUP_INPROGRES] = "CLEANUPINPROGRESS", + [GB_CLEANUP_INPROGRESS] = "CLEANUPINPROGRESS", [GB_CLEANUP_SUCCESS] = "CLEANUPSUCCESS", [GB_CLEANUP_FAIL] = "CLEANUPFAIL", |