summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/snapview-server/src/snapview-server-helpers.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c9
3 files changed, 26 insertions, 8 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c
index 6f305dbc2fb..e7025b70cc6 100644
--- a/xlators/features/snapview-server/src/snapview-server-helpers.c
+++ b/xlators/features/snapview-server/src/snapview-server-helpers.c
@@ -461,8 +461,9 @@ __svs_initialise_snapshot_volume (xlator_t *this, const char *name,
goto out;
}
- snprintf (volname, sizeof (volname), "/snaps/%s/%s",
- dirent->name, dirent->snap_volname);
+ snprintf (volname, sizeof (volname), "/snaps/%s/%s/%s",
+ dirent->name, dirent->snap_volname,
+ dirent->snap_volname);
fs = glfs_new (volname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 84dd077af73..7cc5e98814f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -53,6 +53,7 @@ get_snap_volname_and_volinfo (const char *volpath, char **volname,
char *vol = NULL;
glusterd_snap_t *snap = NULL;
xlator_t *this = NULL;
+ char *volfile_token = NULL;
this = THIS;
GF_ASSERT (this);
@@ -102,12 +103,27 @@ get_snap_volname_and_volinfo (const char *volpath, char **volname,
*/
ret = glusterd_volinfo_find (volname_token, volinfo);
if (ret) {
- *volname = gf_strdup (volname_token);
+ gf_msg (this->name, GF_LOG_WARNING, 0, GD_MSG_VOLINFO_GET_FAIL,
+ "failed to get the volinfo for the volume %s",
+ volname_token);
+
+ /* Get the actual volfile name */
+ volfile_token = strtok_r (NULL, "/", &save_ptr);
+ *volname = gf_strdup (volfile_token);
if (NULL == *volname) {
ret = -1;
goto out;
}
+ /*
+ * Ideally, this should succeed as volname_token now
+ * contains the name of the snap volume (i.e. name of
+ * the volume that represents the snapshot).
+ * But, if for some reason, volinfo for the snap volume
+ * is not found, then try to get from the name of the
+ * volfile. Name of the volfile is like this.
+ * <snap volume name>.<hostname>.<brick path>.vol
+ */
ret = glusterd_snap_volinfo_find (volname_token, snap,
volinfo);
if (ret) {
@@ -116,7 +132,7 @@ get_snap_volname_and_volinfo (const char *volpath, char **volname,
if (!vol) {
gf_msg (this->name, GF_LOG_ERROR, EINVAL,
GD_MSG_INVALID_ENTRY, "Invalid "
- "volname (%s)", volname_token);
+ "volname (%s)", volfile_token);
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index a1fd62da078..30288e32fe6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2067,10 +2067,10 @@ retry:
}
if (volinfo->is_snap_volume) {
- snprintf (volfile, PATH_MAX,"/%s/%s/%s.%s.%s",
+ snprintf (volfile, PATH_MAX, "/%s/%s/%s/%s.%s.%s",
GLUSTERD_VOL_SNAP_DIR_PREFIX,
volinfo->snapshot->snapname, volinfo->volname,
- brickinfo->hostname, exp_path);
+ volinfo->volname, brickinfo->hostname, exp_path);
} else {
snprintf (volfile, PATH_MAX, "%s.%s.%s", volinfo->volname,
brickinfo->hostname, exp_path);
@@ -5552,10 +5552,11 @@ attach_brick (xlator_t *this,
GLUSTERD_GET_BRICK_PIDFILE (pidfile2, volinfo, brickinfo, conf);
if (volinfo->is_snap_volume) {
- snprintf (full_id, sizeof(full_id), "/%s/%s/%s.%s.%s",
+ snprintf (full_id, sizeof(full_id), "/%s/%s/%s/%s.%s.%s",
GLUSTERD_VOL_SNAP_DIR_PREFIX,
volinfo->snapshot->snapname,
- volinfo->volname, brickinfo->hostname, unslashed);
+ volinfo->volname, volinfo->volname,
+ brickinfo->hostname, unslashed);
} else {
snprintf (full_id, sizeof(full_id), "%s.%s.%s",
volinfo->volname, brickinfo->hostname, unslashed);