summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c34
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
7 files changed, 47 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index bea5540..dbf342c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -93,7 +93,11 @@ build_volfile_path (const char *volname, char *path,
vol = strtok_r (dup_volname, ".", &tmp);
if (!vol)
goto out;
- ret = glusterd_volinfo_find (vol, &volinfo);
+ if (!snap_volume)
+ ret = glusterd_volinfo_find (vol, &volinfo);
+ else
+ ret = glusterd_snap_volinfo_find (vol,
+ &volinfo);
if (ret)
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 5b9fc2e..8d7c33d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -3146,7 +3146,7 @@ glusterd_do_snap (glusterd_volinfo_t *volinfo, char *snapname, dict_t *dict,
}
//check whether this is needed or not
- list_add_tail (&snap_volume->vol_list, &priv->volumes);
+ list_add_tail (&snap_volume->vol_list, &priv->snap_list);
list_for_each_entry (brickinfo, &snap_volume->bricks, brick_list) {
if (uuid_compare (brickinfo->uuid, MY_UUID))
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index e26bb1e..16cafdc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1390,9 +1390,9 @@ glusterd_store_perform_snap_volume_store (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
- ret = gf_store_rename_tmppath (snap_volinfo->shandle);
- if (ret)
- goto out;
+ ret = gf_store_rename_tmppath (snap_volinfo->shandle);
+ if (ret)
+ goto out;
out:
if (ret && (fd > 0))
gf_store_unlink_tmppath (volinfo->shandle);
@@ -2992,7 +2992,7 @@ glusterd_store_retrieve_volume (char *volname, glusterd_snap_t *snap)
// as of now snap volume are also added to the list of volume
volinfo->is_snap_volume = _gf_true;
snap->snap_volume = volinfo;
- list_add_tail (&volinfo->vol_list, &priv->volumes);
+ list_add_tail (&volinfo->vol_list, &priv->snap_list);
}
@@ -3222,7 +3222,6 @@ glusterd_store_retrieve_snap_list (char *volname)
gf_store_handle_t *shandle = NULL;
priv = THIS->private;
-
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR, "Couldn't get"
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index dedfd89..d223fab 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1155,7 +1155,6 @@ glusterd_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
glusterd_conf_t *priv = NULL;
GF_ASSERT (volname);
-
this = THIS;
GF_ASSERT (this);
@@ -1164,7 +1163,38 @@ glusterd_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) {
if (!strcmp (tmp_volinfo->volname, volname)) {
- gf_log (this->name, GF_LOG_DEBUG, "Volume %s found", volname);
+ gf_log (this->name, GF_LOG_DEBUG, "Volume %s found",
+ volname);
+ ret = 0;
+ *volinfo = tmp_volinfo;
+ break;
+ }
+ }
+
+ gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
+
+int32_t
+glusterd_snap_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
+{
+ glusterd_volinfo_t *tmp_volinfo = NULL;
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+
+ GF_ASSERT (volname);
+ gf_log ("", GF_LOG_DEBUG, "Snap Volname = %s", volname);
+ this = THIS;
+ GF_ASSERT (this);
+
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ list_for_each_entry (tmp_volinfo, &priv->snap_list, vol_list) {
+ if (!strcmp (tmp_volinfo->volname, volname)) {
+ gf_log (this->name, GF_LOG_DEBUG, "Snap Volume %s found",
+ volname);
ret = 0;
*volinfo = tmp_volinfo;
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 4c98559..e1e5956 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -119,6 +119,9 @@ int32_t
glusterd_peer_hostname_new (char *hostname, glusterd_peer_hostname_t **name);
int32_t
+glusterd_snap_volinfo_find (char *volname, glusterd_volinfo_t **volinfo);
+
+int32_t
glusterd_volinfo_find (char *volname, glusterd_volinfo_t **volinfo);
int
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 8b97a4e..42fd8a7 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1315,6 +1315,7 @@ init (xlator_t *this)
INIT_LIST_HEAD (&conf->peers);
INIT_LIST_HEAD (&conf->volumes);
INIT_LIST_HEAD (&conf->snap_cg);
+ INIT_LIST_HEAD (&conf->snap_list);
pthread_mutex_init (&conf->mutex, NULL);
conf->rpc = rpc;
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 40ae611..b8f0488 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -139,6 +139,7 @@ typedef struct {
nodesrv_t *nfs;
struct pmap_registry *pmap;
struct list_head volumes;
+ struct list_head snap_list; /*List of snap volumes */
pthread_mutex_t xprt_lock;
struct list_head xprt_list;
gf_store_handle_t *handle;