summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2014-02-20 19:22:23 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-03-07 03:24:29 -0800
commit2e58513506919899115935c2ca6b2359fdeff7b8 (patch)
treeefdeb54eeb543716d0aeb1c22d690487d8f8dd62 /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parent1aea4bdc774950f2d313bc541aaccf6d313aac88 (diff)
gluster/snapshot: Create missing backend snapshot folder
Snapshot volume bricks are mounted under /var/run/gluster/snaps folder. In the latest machines /var/run is a symbolic link to /run folder. In such cases if we use /var/run then there would be mismatch between mtab entry for the mount and the folder where we actually mount. Therefore this patch will get the correct folder and also create it if the folder is missing. Change-Id: I267aa7f3e171b486c5b3bb2a9f88cbd4be0e47ea BUG: 1072253 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/7140
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 7bfede011..116dd5153 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -44,6 +44,8 @@
#include <mntent.h>
#endif
+char snap_mount_folder[PATH_MAX];
+
/* This function will restore a snapshot for the entire
* volume or the entire CG (Consistency Group)
*
@@ -717,7 +719,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
ret = snprintf (snap_mount, sizeof(snap_mount) - 1,
"%s/%s%s-brick",
- GLUSTERD_DEFAULT_SNAPS_BRICK_DIR,
+ snap_mount_folder,
snap_volname, device);
snap_mount[ret] = '\0';
@@ -2772,7 +2774,7 @@ glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo,
snap_brick_dir++;
snprintf (snap_brick_mount_path, sizeof (snap_brick_mount_path),
- "%s/%s%s-brick", GLUSTERD_DEFAULT_SNAPS_BRICK_DIR,
+ "%s/%s%s-brick", snap_mount_folder,
snap_volinfo->volname, tmp);
snprintf (snap_brick_path, sizeof (snap_brick_path), "%s/%s",