summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2018-03-01 17:34:05 +0530
committerKaushal M <kaushal@redhat.com>2018-03-02 09:00:14 +0000
commitfc35d400cba928de610b90adb5854dd1594fcd4a (patch)
treee0d2986a446ec4350e167cf3c26adb7707e41975 /libglusterfs
parent7e7fd3595e3ee7e260df4566edf5e1ac95fddd82 (diff)
libglusterfs: Fix volume_options_t struct
The volume_options_t struct was modified and a new member was introduced in the middle of the struct. This caused GD2 to crash when it tried to read the volume options. The new member has been moved to the end of the struct to correct this. And a note has been added to notify developers on how to modify this struct, and the xlator_api_t struct. Updates: gluster/glusterfs#302 Change-Id: I2e9899ec10516be29c7e9d574da53be8ec17a99e Signed-off-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/options.h8
-rw-r--r--libglusterfs/src/xlator.h11
2 files changed, 18 insertions, 1 deletions
diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h
index f741df25a37..1aa27341624 100644
--- a/libglusterfs/src/options.h
+++ b/libglusterfs/src/options.h
@@ -82,6 +82,10 @@ typedef enum {
/* Each translator should define this structure */
+/* XXX: This structure is in use by GD2, and SHOULD NOT be modified.
+ * If there is a need to add new members, add them to the end of the structure.
+ * If the struct must be modified, GD2 MUST be updated as well
+ */
typedef struct volume_options {
char *key[ZR_VOLUME_MAX_NUM_KEY];
/* different key, same meaning */
@@ -98,7 +102,6 @@ typedef struct volume_options {
* happen
*/
opt_validate_type_t validate;
- opt_level_t level;
/* The op-version at which this option was introduced.
* This is an array to support options that get backported to supported
@@ -131,6 +134,9 @@ typedef struct volume_options {
*/
char *setkey;
+ /* The level at which the option is classified
+ */
+ opt_level_t level;
} volume_option_t;
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 0e50bef1cb6..bfab57a0133 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -1052,6 +1052,10 @@ typedef struct {
/* This would be the only structure which needs to be exported by
the translators. For the backward compatibility, in 4.x series
even the old exported fields will be supported */
+/* XXX: This struct is in use by GD2, and hence SHOULD NOT be modified.
+ * If the struct must be modified, see instructions at the comment with
+ * GD2MARKER below.
+ */
typedef struct {
/* op_version: will be used by volume generation logic to figure
out whether to insert it in graph or no, based on cluster's
@@ -1075,6 +1079,13 @@ typedef struct {
volume file, then that should be defined here. optional. */
volume_option_t *options;
+ /* XXX: GD2MARKER
+ * If a new member that needs to be visible to GD2 is introduced,
+ * add it above this comment.
+ * Any other new members need to be added below this comment, or at the
+ * end of the struct
+ */
+
/* init(): mandatory method, will be called during the
graph initialization */
int32_t (*init) (xlator_t *this);