path: root/xlators/storage/posix/src
diff options
authorAmar Tumballi <>2019-08-06 23:20:02 +0300
committerAmar Tumballi <>2019-09-30 17:24:08 +0000
commitae729065c0d9cb5411e5c31231b5e293b560d76a (patch)
tree74450566bd20c49cdaff8aa1826737f2b2454421 /xlators/storage/posix/src
parentc6df9e962483bac5bfcd8916318b19040387ce81 (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 <>
Diffstat (limited to 'xlators/storage/posix/src')
1 files changed, 7 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index c8f9217..abe086d 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -144,7 +144,13 @@ posix_notify(xlator_t *this, int32_t event, void *data, ...)
switch (event) {
- /* the parent that posix xlator is up */
+ /* Notify the parent that posix xlator is up */
+ char *volume_id;
+ int ret = dict_get_str(this->options, "volume-id", &volume_id);
+ if (!ret) {
+ strncpy(this->graph->volume_id, volume_id,
+ min(strlen(volume_id), GF_UUID_BUF_SIZE));
+ }
default_notify(this, GF_EVENT_CHILD_UP, data);
} break;