diff options
author | Raghavendra G <raghavendra@gluster.com> | 2012-02-08 15:06:30 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-21 01:05:14 -0800 |
commit | 7197111677619da96c80572a09331d6e28c1015b (patch) | |
tree | 4ebe916f4aa9b4bd34ab23a1c6ec145fd60c3b27 /xlators/mount/fuse/src/fuse-helpers.c | |
parent | 6d19136de7af9135dd23662f18c3ee544a2888da (diff) |
fuse-bridge: Handle graph-switch.
The purpose of this patch is to let protocol/client know when its transports can
be disconnected, without application running on gluster mount noticing any
effects of graph switch.
In order to do this, we migrate all fds and blocked locks to new graph.
Once this migration is complete and there are no in-transit frames as viewed
by fuse-bridge, we send a PARENT_DOWN event to its children. protocol/client
on receiving this event, can disconnect up its transports.
Change-Id: Idcea4bc43e23fb077ac16538b61335ebad84ba16
BUG: 767862
Reviewed-on: http://review.gluster.com/2734
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mount/fuse/src/fuse-helpers.c')
-rw-r--r-- | xlators/mount/fuse/src/fuse-helpers.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index c794813cf3c..6aee697158c 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -57,6 +57,15 @@ fuse_resolve_wipe (fuse_resolve_t *resolve) void free_fuse_state (fuse_state_t *state) { + xlator_t *this = NULL; + fuse_private_t *priv = NULL; + uint64_t winds = 0; + char switched = 0; + + this = state->this; + + priv = this->private; + loc_wipe (&state->loc); loc_wipe (&state->loc2); @@ -81,6 +90,18 @@ free_fuse_state (fuse_state_t *state) fuse_resolve_wipe (&state->resolve); fuse_resolve_wipe (&state->resolve2); + pthread_mutex_lock (&priv->sync_mutex); + { + winds = --state->active_subvol->winds; + switched = state->active_subvol->switched; + } + pthread_mutex_unlock (&priv->sync_mutex); + + if ((winds == 0) && (switched)) { + xlator_notify (state->active_subvol, GF_EVENT_PARENT_DOWN, + state->active_subvol, NULL); + } + #ifdef DEBUG memset (state, 0x90, sizeof (*state)); #endif @@ -92,8 +113,9 @@ free_fuse_state (fuse_state_t *state) fuse_state_t * get_fuse_state (xlator_t *this, fuse_in_header_t *finh) { - fuse_state_t *state = NULL; - xlator_t *active_subvol = NULL; + fuse_state_t *state = NULL; + xlator_t *active_subvol = NULL; + fuse_private_t *priv = NULL; state = (void *)GF_CALLOC (1, sizeof (*state), gf_fuse_mt_fuse_state_t); @@ -101,7 +123,15 @@ get_fuse_state (xlator_t *this, fuse_in_header_t *finh) return NULL; state->this = THIS; - active_subvol = fuse_active_subvol (state->this); + priv = this->private; + + pthread_mutex_lock (&priv->sync_mutex); + { + active_subvol = fuse_active_subvol (state->this); + active_subvol->winds++; + } + pthread_mutex_unlock (&priv->sync_mutex); + state->active_subvol = active_subvol; state->itable = active_subvol->itable; |