diff options
author | Venky Shankar <vshankar@redhat.com> | 2015-06-02 21:23:48 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-06-25 04:42:40 -0700 |
commit | 17b838ce18e0eb9dbfe9a540a3006023b19276e7 (patch) | |
tree | 63b9c504e346b0dbf39d66a3489811abec82b7a3 /xlators/features/bit-rot/src/bitd/bit-rot.h | |
parent | 9b1305e549879e7698c46553bd91c722877d44cb (diff) |
features/bitrot: cleanup, v1
This is a short series of patches (with other cleanups) aimed at
cleaning up some of the incorrect assumptions taken in reconfigure()
leading to crashes when subvolumes are not fully initialized (as
reported here[1] on gluster-devel@). Furthermore, there is some
amount of code cleanup to handle disconnection and cleanup up data
structure (as part of subsequent patch).
[1] http://www.gluster.org/pipermail/gluster-devel/2015-June/045410.html
Change-Id: I68ac4bccfbac4bf02fcc31615bd7d2d191021132
BUG: 1231617
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/11147
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot.h')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h index 7be4398d00d..d4742f4fea4 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -71,7 +71,18 @@ struct br_scanfs { struct gf_tw_timer_list *timer; }; +/* just need three states to track child status */ +typedef enum br_child_state { + BR_CHILD_STATE_CONNECTED = 1, + BR_CHILD_STATE_INITIALIZING, + BR_CHILD_STATE_CONNFAILED, + BR_CHILD_STATE_DISCONNECTED, +} br_child_state_t; + struct br_child { + gf_lock_t lock; + br_child_state_t c_state; + char child_up; /* Indicates whether this child is up or not */ xlator_t *xl; /* client xlator corresponding to @@ -135,8 +146,8 @@ typedef struct br_obj_n_workers br_obj_n_workers_t; struct br_private { pthread_mutex_t lock; - struct list_head bricks; /* list of bricks from which CHILD_UP - has been received */ + struct list_head bricks; /* list of bricks from which enents + have been received */ struct list_head signing; @@ -202,5 +213,22 @@ br_prepare_loc (xlator_t *, br_child_t *, loc_t *, gf_dirent_t *, loc_t *); gf_boolean_t bitd_is_bad_file (xlator_t *, br_child_t *, loc_t *, fd_t *); +static inline void +_br_set_child_state (br_child_t *child, br_child_state_t state) +{ + child->c_state = state; +} + +static inline int +_br_is_child_connected (br_child_t *child) +{ + return (child->c_state == BR_CHILD_STATE_CONNECTED); +} + +static inline int +_br_child_failed_conn (br_child_t *child) +{ + return (child->c_state == BR_CHILD_STATE_CONNFAILED); +} #endif /* __BIT_ROT_H__ */ |