summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-10-24 10:24:10 +0530
committershishir gowda <sgowda@redhat.com>2013-11-15 12:48:08 +0530
commitd8c95f33e2557aff81d4a7f3e22f1c784183f5aa (patch)
treef116fd06576e4d91736d5dfa0a4e66b4d87d9eb2
parenta39af9c2923850ab9d49fb0c2e26629348d50f9b (diff)
mgmt/glusterd: Snapstore fixes to make info file persistent
Change-Id: I30cbbeb135c2d0a780e9e414ac0a96739e25647b Signed-off-by: shishir gowda <sgowda@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index b1ce059..39f3671 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1356,6 +1356,9 @@ glusterd_store_snap_volume (glusterd_volinfo_t *volinfo, glusterd_snap_t *snap)
{
snap_volinfo = snap->snap_volume;
+ if (!snap_volinfo)
+ goto unlock;
+
ret = glusterd_store_create_snap_vol_dir (volinfo,
snap->snap_name);
if (ret) {
@@ -2904,6 +2907,7 @@ glusterd_store_retrieve_snap_list (char *volname)
gf_store_op_errno_t op_errno = GD_STORE_SUCCESS;
glusterd_snap_t *snap = NULL;
uint64_t count = 0;
+ gf_store_handle_t *shandle = NULL;
priv = THIS->private;
@@ -2935,6 +2939,7 @@ glusterd_store_retrieve_snap_list (char *volname)
GF_FREE (value);
value = NULL;
+ shandle = volinfo->snap_list_shandle;
while (count <= volinfo->snap_count) {
snap = glusterd_new_snap_object ();
if (!snap) {
@@ -2945,18 +2950,18 @@ glusterd_store_retrieve_snap_list (char *volname)
snprintf (key, sizeof (key), "%s-%"PRIu64,
GLUSTERD_STORE_KEY_SNAP_NAME, count);
- ret = gf_store_iter_get_matching (iter, key, &value);
+ ret = gf_store_retrieve_value (shandle, key, &value);
if (ret)
goto out;
- strncpy (snap->snap_name, value, sizeof (*value));
+ strncpy (snap->snap_name, value, strlen(value));
GF_FREE (value);
value = NULL;
snprintf (key, sizeof (key), "%s-%"PRIu64,
GLUSTERD_STORE_KEY_SNAP_STATUS, count);
- ret = gf_store_iter_get_matching (iter, key,
- &value);
+ ret = gf_store_retrieve_value (shandle, key,
+ &value);
if (ret)
goto out;
@@ -2966,7 +2971,7 @@ glusterd_store_retrieve_snap_list (char *volname)
snprintf (key, sizeof (key), "%s-%"PRIu64,
GLUSTERD_STORE_KEY_SNAP_ID, count);
- ret = gf_store_iter_get_matching (iter, key, &value);
+ ret = gf_store_retrieve_value (shandle, key, &value);
if (ret)
goto out;
@@ -2976,7 +2981,7 @@ glusterd_store_retrieve_snap_list (char *volname)
snprintf (key, sizeof (key), "%s-%"PRIu64,
GLUSTERD_STORE_KEY_SNAP_CG_ID, count);
- ret = gf_store_iter_get_matching (iter, key, &value);
+ ret = gf_store_retrieve_value (shandle, key, &value);
if (ret)
goto out;