diff options
authorSunny Kumar <>2018-08-22 02:08:40 +0530
committerAtin Mukherjee <>2018-08-23 02:24:43 +0000
commitab27d4288997acc1b6c6bdd55a3387644eea6ecd (patch)
parentfaf736cb3043ade5b2ad3267c45d2ba0bce53b52 (diff)
snapshot : fix snapshot status failure due to symlink problem
Problems : 1. Snapshot status for individual snapshots were failing after OS upgrade from RHEL6 to RHEL7. 2. Post upgrade snapshot creation of cloned volume was failing. Root Cause : When OS upgrade is from RHEL6 to RHEL7 there is difference in symlink (/var/run) between these two versions. Basically when (/var/run) is symlinked to /run, mount command resolves path and mounts it. But at the same time call to those functions fails who depends on absolute path. (like strcmp in glusterd_get_mnt_entry_info) Solution : Resolve the input path to absolute path before calling these functions. Test : Tested on same setup where issue was reported. After this patch snapshot issues are completely resolved. Change-Id: I5ba57998cea614c6072709f52f42a57562018844 fixes: bz#1619843 Signed-off-by: Sunny Kumar <>
1 files changed, 9 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 06d17ea5710..87c1fcaaad1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7027,6 +7027,7 @@ glusterd_get_mnt_entry_info (char *mnt_pt, char *buff, int buflen,
struct mntent *entry = NULL;
FILE *mtab = NULL;
+ char abspath[PATH_MAX] = "";
GF_ASSERT (mnt_pt);
GF_ASSERT (buff);
@@ -7036,13 +7037,20 @@ glusterd_get_mnt_entry_info (char *mnt_pt, char *buff, int buflen,
if (!mtab)
goto out;
+ if (!realpath (mnt_pt, abspath)) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ "realpath () failed for path %s", mnt_pt);
+ goto out;
+ }
entry = getmntent_r (mtab, entry_ptr, buff, buflen);
while (1) {
if (!entry)
goto out;
- if (!strcmp (entry->mnt_dir, mnt_pt) &&
+ if (!strcmp (entry->mnt_dir, abspath) &&
strcmp (entry->mnt_type, "rootfs"))
entry = getmntent_r (mtab, entry_ptr, buff, buflen);