From 446ddbf1b10ce835e0e40790bc997ec6ac53766a Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Fri, 9 Feb 2018 21:02:09 +0530 Subject: glusterd/snapshot : fix the compare snap logic In one of the case in commit cb0339f there's one particular case where after removing the old snap it wasn't writing the new snap version and this resulted into one of the test to fail spuriously. Change-Id: I3e83435fb62d6bba3bbe227e40decc6ce37ea77b BUG: 1540607 Signed-off-by: Atin Mukherjee --- ...shot-issue-with-other-processes-accessing-mounted-path.t | 13 +++++++++++++ xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t b/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t index c5a0088170..8dffdb21d8 100644 --- a/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t +++ b/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t @@ -92,8 +92,16 @@ EXPECT "0" mounted_snaps ${V1} # handled during handshake. activate_snapshots + +EXPECT 'Started' snapshot_status ${V0}_snap; +EXPECT 'Started' snapshot_status ${V1}_snap; + kill_glusterd 2 + deactivate_snapshots +EXPECT 'Stopped' snapshot_status ${V0}_snap; +EXPECT 'Stopped' snapshot_status ${V1}_snap; + TEST start_glusterd 2 # Updates form friend should reflect as snap was deactivated while glusterd @@ -104,8 +112,13 @@ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" mounted_snaps ${V1} kill_glusterd 2 activate_snapshots +EXPECT 'Started' snapshot_status ${V0}_snap; +EXPECT 'Started' snapshot_status ${V1}_snap; + TEST start_glusterd 2 +EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count; + # Updates form friend should reflect as snap was activated while glusterd # process was inactive and mount point should exist. EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" mounted_snaps ${V0} diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 0c78596fec..340289f74e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -1911,6 +1911,10 @@ glusterd_compare_snap (dict_t *peer_data, int32_t snap_count, snprintf (buf, sizeof(buf), "%s.remove_my_data", prefix); ret = dict_set_uint32 (peer_data, buf, 1); + snprintf (buf, sizeof(buf), "%s.accept_peer_data", + prefix); + ret = dict_set_uint32 (peer_data, buf, 1); + } else { ret = 0; } -- cgit