summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@gmail.com>2019-08-06 23:20:02 +0300
committerAmar Tumballi <amarts@gmail.com>2019-09-30 17:24:08 +0000
commitae729065c0d9cb5411e5c31231b5e293b560d76a (patch)
tree74450566bd20c49cdaff8aa1826737f2b2454421 /libglusterfs
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 <amarts@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/glusterfs/glusterfs.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libglusterfs/src/glusterfs/glusterfs.h b/libglusterfs/src/glusterfs/glusterfs.h
index 155bf435386..0b2d7b18efe 100644
--- a/libglusterfs/src/glusterfs/glusterfs.h
+++ b/libglusterfs/src/glusterfs/glusterfs.h
@@ -596,6 +596,7 @@ struct _glusterfs_graph {
pthread_cond_t child_down_cond; /* for broadcasting CHILD_DOWN */
int parent_down;
char graph_uuid[128];
+ char volume_id[GF_UUID_BUF_SIZE];
};
typedef struct _glusterfs_graph glusterfs_graph_t;
@@ -731,6 +732,8 @@ struct _glusterfs_ctx {
pthread_cond_t janitor_cond;
pthread_mutex_t janitor_lock;
pthread_t janitor;
+
+ char volume_id[GF_UUID_BUF_SIZE]; /* Used only in protocol/client */
};
typedef struct _glusterfs_ctx glusterfs_ctx_t;