diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2019-07-30 10:15:42 +0300 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-08-05 03:08:13 +0000 |
commit | 2aeb9fb17087434d87497a85077073ea3bf94869 (patch) | |
tree | 3625e683a27b8719ee97d89702815c89b6c5d2e4 /xlators/mgmt/glusterd/src/glusterd-replace-brick.c | |
parent | 2dd43d3e5b5305db3a5ecafabdd9cf8e7775ec75 (diff) |
multiple files: reduce minor work under RCU_READ_LOCK
1. Try to unlock faster - in error paths.
2. Remove memory allocations - do them before the lock.
Change-Id: I1e9ddd80b99de45ad0f557d62a5f28951dfd54c8
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-replace-brick.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index ca1de1a915f..efaddde67e2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -272,31 +272,34 @@ glusterd_op_stage_replace_brick(dict_t *dict, char **op_errstr, peerinfo = glusterd_peerinfo_find(NULL, host); if (peerinfo == NULL) { + RCU_READ_UNLOCK; ret = -1; snprintf(msg, sizeof(msg), "%s, is not a friend", host); *op_errstr = gf_strdup(msg); + goto out; } else if (!peerinfo->connected) { + RCU_READ_UNLOCK; + ret = -1; snprintf(msg, sizeof(msg), "%s, is not connected at " "the moment", host); *op_errstr = gf_strdup(msg); - ret = -1; + goto out; } else if (GD_FRIEND_STATE_BEFRIENDED != peerinfo->state.state) { + RCU_READ_UNLOCK; + ret = -1; snprintf(msg, sizeof(msg), "%s, is not befriended " "at the moment", host); *op_errstr = gf_strdup(msg); - ret = -1; + goto out; } RCU_READ_UNLOCK; - if (ret) - goto out; - } else if (priv->op_version >= GD_OP_VERSION_3_6_0) { /* A bricks mount dir is required only by snapshots which were * introduced in gluster-3.6.0 |