diff options
author | Amar Tumballi <amarts@gmail.com> | 2019-08-06 23:20:02 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@gmail.com> | 2019-09-30 17:24:08 +0000 |
commit | ae729065c0d9cb5411e5c31231b5e293b560d76a (patch) | |
tree | 74450566bd20c49cdaff8aa1826737f2b2454421 /tests | |
parent | c6df9e962483bac5bfcd8916318b19040387ce81 (diff) |
protocol/handshake: pass volume-id for extra check
With added check of volume-id during handshake, we can be sure to not
connect with a brick if this gets re-used in another volume. This
prevents any accidental issues which can happen with a stale client
process lurking along.
Also added test case for testing same volume name which would fetch a
different volfile (ie, different bricks, different type), and a
different volume name, but same brick.
For reference:
Currently a client<->server handshake happens in glusterfs through
protocol/client translator (setvolume) to protocol/server using a
dictionary which containes many keys. Rejection happens in server
side if some of the required keys are missing in handshake
dictionary.
Till now, there was no single unique identifier to validate for a
client to tell server if it is actually talking to a corresponding
server. All we look in protocol/client is a key called
'remote-subvolume', which should match with a subvolume name in server
volume file, and for any volume with same brick name (can be present
in same cluster due to recreate), it would be same. This could cause
major issue, when a client was connected to a given brick, in one
volume would be connected to another volume's brick if its
re-created/re-used.
To prevent this behavior, we are now passing along 'volume-id' in
handshake, which would be preserved for the life of client process,
which can prevent this accidental connections.
NOTE: This behavior wouldn't be applicable for user-snapshot enabled
volumes, as snapshotted volume's would have different volume-id.
Fixes: bz#1620580
Change-Id: Ie98286e94ce95ae09c2135fd6ec7d7c2ca1e8095
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs/bug-1620580.t | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/bugs/bug-1620580.t b/tests/bugs/bug-1620580.t new file mode 100644 index 00000000000..bc113d462e7 --- /dev/null +++ b/tests/bugs/bug-1620580.t @@ -0,0 +1,51 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +## Lets create volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; + +## Verify volume is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs -s $H0 --volfile-id=$V0 $M0 + +#do some operation on mount, so that kill_brick is guaranteed to be +#done _after_ first lookup on root + +TEST ls $M0 +TEST touch $M0/file + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +# Case of Same volume name, but different bricks +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{3,4}; +TEST $CLI volume start $V0; + +# Give time for 'reconnect' to happen +sleep 4 + +TEST ! ls $M0 + +# Case of Same brick, but different volume (ie, recreated). +TEST $CLI volume create $V1 $H0:$B0/${V0}{1,2}; +TEST $CLI volume start $V1; + +# Give time for 'reconnect' to happen +sleep 4 +TEST ! ls $M0 +TEST ! stat $M0/file + +cleanup |