summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-03-29 19:06:46 +0530
committerVenky Shankar <vshankar@redhat.com>2016-03-31 08:56:13 -0700
commit5560961e5188c6b8f4b09d57245513a8f9612ff4 (patch)
treefb52fe0d7c7502eff5d919ede131410c58db56ef /xlators
parent3d34c495d547866a533bc0614b14163381830095 (diff)
features/changelog: Don't modify 'pargfid' in 'resolve_pargfid_to_path'
Backport of http://review.gluster.org/#/c/13845/ If 'changelog' is enabled and 'changelog.capture-del-path' option is on it calls 'resolve_pargfid_to_path' which modifies 'pargfid' sent by caller. 'changelog_unlink' calls this routine directly with 'loc->pargfid' resulting it being modified and point to root instead of actual pargfid. This is a nasty bug and could cause the deletion of entry on root directory instead on actual parent when 'loc->path' is not present. Hence this fix to make 'pargfid' a const pointer and 'resolve_pargfid' to work on copy of pargfid. Glusterfind session creation enables these options by default to capture deleted entry path in changelog. Thanks Pranith for root causing this. BUG: 1322552 Change-Id: I9f2bc44b5604b224462594c12b7d79e68198d693 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/13861 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/changelog/src/changelog-helpers.c4
-rw-r--r--xlators/features/changelog/src/changelog-helpers.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c
index d692753f084..ba98021520b 100644
--- a/xlators/features/changelog/src/changelog-helpers.c
+++ b/xlators/features/changelog/src/changelog-helpers.c
@@ -1847,7 +1847,7 @@ err:
*/
int
-resolve_pargfid_to_path (xlator_t *this, uuid_t pargfid,
+resolve_pargfid_to_path (xlator_t *this, const uuid_t pgfid,
char **path, char *bname)
{
char *linkname = NULL;
@@ -1857,6 +1857,7 @@ resolve_pargfid_to_path (xlator_t *this, uuid_t pargfid,
ssize_t len = 0;
int ret = 0;
uuid_t tmp_gfid = {0, };
+ uuid_t pargfid = {0, };
changelog_priv_t *priv = NULL;
char gpath[PATH_MAX] = {0,};
char result[PATH_MAX] = {0,};
@@ -1867,6 +1868,7 @@ resolve_pargfid_to_path (xlator_t *this, uuid_t pargfid,
priv = this->private;
GF_ASSERT (priv);
+ gf_uuid_copy (pargfid, pgfid);
if (!path || gf_uuid_is_null (pargfid)) {
ret = -1;
goto out;
diff --git a/xlators/features/changelog/src/changelog-helpers.h b/xlators/features/changelog/src/changelog-helpers.h
index b4f0ed053ae..1d548ca1adc 100644
--- a/xlators/features/changelog/src/changelog-helpers.h
+++ b/xlators/features/changelog/src/changelog-helpers.h
@@ -503,7 +503,8 @@ changelog_inode_ctx_t *
__changelog_inode_ctx_get (xlator_t *, inode_t *, unsigned long **,
unsigned long *, changelog_log_type);
int
-resolve_pargfid_to_path (xlator_t *this, uuid_t gfid, char **path, char *bname);
+resolve_pargfid_to_path (xlator_t *this, const uuid_t gfid, char **path,
+ char *bname);
/* macros */