diff options
Diffstat (limited to 'libglusterfs/src/defaults-tmpl.c')
| -rw-r--r-- | libglusterfs/src/defaults-tmpl.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libglusterfs/src/defaults-tmpl.c b/libglusterfs/src/defaults-tmpl.c index bdb30d4872c..3cf707f42aa 100644 --- a/libglusterfs/src/defaults-tmpl.c +++ b/libglusterfs/src/defaults-tmpl.c @@ -25,8 +25,8 @@ #include "config.h" #endif -#include "xlator.h" -#include "defaults.h" +#include "glusterfs/xlator.h" +#include "glusterfs/defaults.h" #pragma generate @@ -84,6 +84,7 @@ struct xlator_fops _default_fops = { .put = default_put, .icreate = default_icreate, .namelink = default_namelink, + .copy_file_range = default_copy_file_range, }; struct xlator_fops *default_fops = &_default_fops; @@ -126,6 +127,12 @@ default_notify(xlator_t *this, int32_t event, void *data, ...) GF_UNUSED int ret = 0; xlator_t *victim = data; + glusterfs_graph_t *graph = NULL; + + GF_VALIDATE_OR_GOTO("notify", this, out); + graph = this->graph; + GF_VALIDATE_OR_GOTO(this->name, graph, out); + switch (event) { case GF_EVENT_PARENT_UP: case GF_EVENT_PARENT_DOWN: { @@ -158,6 +165,20 @@ default_notify(xlator_t *this, int32_t event, void *data, ...) xlator_notify(parent->xlator, event, this, NULL); parent = parent->next; } + + if (event == GF_EVENT_CHILD_DOWN && + !(this->ctx && this->ctx->master) && (graph->top == this)) { + /* Make sure this is not a daemon with master xlator */ + pthread_mutex_lock(&graph->mutex); + { + if (graph->parent_down == + graph_total_client_xlator(graph)) { + graph->used = 0; + pthread_cond_broadcast(&graph->child_down_cond); + } + } + pthread_mutex_unlock(&graph->mutex); + } } break; case GF_EVENT_UPCALL: { xlator_list_t *parent = this->parents; @@ -204,7 +225,7 @@ default_notify(xlator_t *this, int32_t event, void *data, ...) * nothing to do with readability. */ } - +out: return 0; } |
