diff options
-rw-r--r-- | libglusterfs/src/compat-uuid.h | 2 | ||||
-rw-r--r-- | tests/bugs/changelog/bug-1321955.t | 60 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-helpers.c | 4 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-helpers.h | 3 |
4 files changed, 66 insertions, 3 deletions
diff --git a/libglusterfs/src/compat-uuid.h b/libglusterfs/src/compat-uuid.h index 4161b958508..8dac6990388 100644 --- a/libglusterfs/src/compat-uuid.h +++ b/libglusterfs/src/compat-uuid.h @@ -28,7 +28,7 @@ gf_uuid_compare (uuid_t u1, uuid_t u2) } static inline void -gf_uuid_copy (uuid_t dst, uuid_t src) +gf_uuid_copy (uuid_t dst, const uuid_t src) { uuid_copy (dst, src); } diff --git a/tests/bugs/changelog/bug-1321955.t b/tests/bugs/changelog/bug-1321955.t new file mode 100644 index 00000000000..9e3752b1728 --- /dev/null +++ b/tests/bugs/changelog/bug-1321955.t @@ -0,0 +1,60 @@ +#!/bin/bash + +#This file checks if missing entry self-heal and entry self-heal are working +#as expected. +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../afr.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 changelog.changelog enable +TEST $CLI volume set $V0 changelog.capture-del-path on +TEST $CLI volume start $V0 + +#Mount the volume +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +#Create files +TEST touch $M0/file1 +TEST mkdir $M0/dir1 +TEST touch $M0/dir1/file1 + +#Check for presence of files +TEST stat $B0/${V0}0/dir1/file1 +TEST stat $B0/${V0}1/dir1/file1 +TEST stat $B0/${V0}0/file1 +TEST stat $B0/${V0}1/file1 + +#Kill brick1 +TEST kill_brick $V0 $H0 $B0/${V0}1 + +#Del dir1/file1 +TEST rm -f $M0/dir1/file1 + +#file1 should be present in brick1 and not in brick0 +TEST ! stat $B0/${V0}0/dir1/file1 +TEST stat $B0/${V0}1/dir1/file1 + +#Bring up the brick which is down +TEST $CLI volume start $V0 force +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 + +#Initiate heal +TEST $CLI volume heal $V0 + +EXPECT_WITHIN $HEAL_TIMEOUT "0" get_pending_heal_count $V0 + +#dir1/file1 in brick1 should be deleted +TEST ! stat $B0/${V0}1/dir1/file1 + +#file1 under root should not be deleted in brick1 +TEST stat $B0/${V0}1/file1 + +cleanup; diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c index 5783aaf3e29..6d3b99c6cdc 100644 --- a/xlators/features/changelog/src/changelog-helpers.c +++ b/xlators/features/changelog/src/changelog-helpers.c @@ -1910,7 +1910,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; @@ -1920,6 +1920,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,}; @@ -1930,6 +1931,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 df307382d34..70e6f60f30c 100644 --- a/xlators/features/changelog/src/changelog-helpers.h +++ b/xlators/features/changelog/src/changelog-helpers.h @@ -504,7 +504,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 */ |