diff options
author | Anoop C S <achiraya@redhat.com> | 2014-10-29 09:12:46 -0400 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2014-12-08 01:54:45 -0800 |
commit | cd6ffa93dc2a3cb1fcc5438086aebc54f368c2e9 (patch) | |
tree | f7015ad650eea8557aadef3ac703c44aae8fb5b8 /api/src/glfs-master.c | |
parent | 92a293220117f896bfcc1950dabd5bb1bfae9965 (diff) |
libgfapi: Wait for GF_EVENT_CHILD_DOWN in glfs_fini()
Whenever glfs_fini() is being called, currently no
check is made inside the function to determine whether
the child is already down or not. This patch will wait
for GF_EVENT_CHILD_DOWN for the active subvol and
then exits.
TBD:
Apart from the active subvol, wait for other CHILD_DOWN
events generated through operations like volume set in
future.
Change-Id: I81c64ac07b463bfed48bf306f9e8f46ba0f0a76f
BUG: 1153610
Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-on: http://review.gluster.org/9060
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'api/src/glfs-master.c')
-rw-r--r-- | api/src/glfs-master.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/api/src/glfs-master.c b/api/src/glfs-master.c index 89017bab84d..edf9aae37e9 100644 --- a/api/src/glfs-master.c +++ b/api/src/glfs-master.c @@ -99,10 +99,21 @@ notify (xlator_t *this, int event, void *data, ...) graph->id); break; case GF_EVENT_CHILD_UP: + pthread_mutex_lock (&fs->mutex); + { + graph->used = 1; + } + pthread_mutex_unlock (&fs->mutex); graph_setup (fs, graph); glfs_init_done (fs, 0); break; case GF_EVENT_CHILD_DOWN: + pthread_mutex_lock (&fs->mutex); + { + graph->used = 0; + pthread_cond_broadcast (&fs->child_down_cond); + } + pthread_mutex_unlock (&fs->mutex); graph_setup (fs, graph); glfs_init_done (fs, 1); break; |