summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-locks.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2018-07-31 12:33:49 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-08-16 12:32:04 +0530
commit0b450b8b35cf8f03d51eeb5b0941832cde636993 (patch)
treeaf0a21f0e7c15d389707d6174e2001dba6a8a4a2 /xlators/mgmt/glusterd/src/glusterd-locks.c
parentfa2f092709a6a2d91213cb3410fc5b5109d84646 (diff)
glusterd: ignore importing volume which is undergoing a delete operation
Problem explanation: Assuming in a 3 nodes cluster, if N1 originates a delete operation and while N1's commit phase completes, either glusterd service of N2 or N3 gets disconnected from N1 (before completing the commit phase), N1 will attempt to end up importing the volume which is in-flight for a delete in other nodes as a fresh resulting into an incorrect configuration state. Fix: Mark a volume as stage deleted once a volume delete operation passes it's staging phase and reset this flag during unlock phase. Now during this intermediate phase if the same volume gets imported to other peers, it shouldn't considered to be recreated. An automated .t is quite tough to implement with the current infra. Test Case: 1. Keep creating and deleting volumes in a loop on a 3 node cluster 2. Simulate n/w failure between the peers (ifdown followed by ifup) 3. Check if output of 'gluster v list | wc -l' is same across all 3 nodes during 1 & 2. Change-Id: Ifdd5dc39699120258d7fdd42fe2deb9de25c6246 Fixes: bz#1605077 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-locks.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index cc9c03f5683..1e99117b3a1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -790,6 +790,7 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
int32_t ret = -1;
gf_boolean_t is_valid = _gf_true;
glusterd_conf_t *priv = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
uuid_t owner = {0};
xlator_t *this = NULL;
@@ -888,7 +889,6 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
"Lock for %s %s successfully released",
type, name);
- ret = 0;
/* Release owner reference which was held during lock */
if (mgmt_lock_timer->timer) {
ret = -1;
@@ -905,6 +905,15 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
mgmt_lock_timer->timer);
dict_del (priv->mgmt_v3_lock_timer, key_dup);
}
+ ret = glusterd_volinfo_find (name, &volinfo);
+ if (volinfo && volinfo->stage_deleted) {
+ /* this indicates a volume still exists and the volume delete
+ * operation has failed in some of the phases, need to ensure
+ * stage_deleted flag is set back to false
+ */
+ volinfo->stage_deleted = _gf_false;
+ }
+ ret = 0;
out:
gf_msg_trace (this->name, 0, "Returning %d", ret);