diff options
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 78 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/mem-types.h | 5 | ||||
-rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 11 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 31 |
6 files changed, 108 insertions, 19 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index f4445acf6..1c9220927 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -1124,6 +1124,83 @@ out: } int +glusterfs_handle_volume_barrier_op (rpcsvc_request_t *req) +{ + int32_t ret = -1; + gd1_mgmt_brick_op_req xlator_req = {0,}; + dict_t *dict = NULL; + xlator_t *xlator = NULL; + xlator_t *any = NULL; + dict_t *output = NULL; + char msg[2048] = {0}; + glusterfs_ctx_t *ctx = NULL; + glusterfs_graph_t *active = NULL; + xlator_t *this = NULL; + + GF_ASSERT (req); + this = THIS; + GF_ASSERT (this); + + ctx = glusterfsd_ctx; + GF_ASSERT (ctx); + + active = ctx->active; + if (!active) { + req->rpc_err = GARBAGE_ARGS; + goto out; + } + + any = active->first; + ret = xdr_to_generic (req->msg[0], &xlator_req, + (xdrproc_t)xdr_gd1_mgmt_brick_op_req); + if (ret < 0) { + //failed to decode msg; + req->rpc_err = GARBAGE_ARGS; + goto out; + } + dict = dict_new (); + if (!dict) + goto out; + + ret = dict_unserialize (xlator_req.input.input_val, + xlator_req.input.input_len, + &dict); + if (ret < 0) { + gf_log (this->name, GF_LOG_ERROR, + "failed to " + "unserialize req-buffer to dictionary"); + goto out; + } + xlator = xlator_search_by_name (any, xlator_req.name); + if (!xlator) { + snprintf (msg, sizeof (msg), "xlator %s is not loaded", + xlator_req.name); + goto out; + } + + output = dict_new (); + if (!output) { + ret = -1; + goto out; + } + + ret = xlator->notify (xlator, GF_EVENT_VOLUME_BARRIER_OP, + dict, output); + + ret = glusterfs_translator_info_response_send (req, ret, + msg, output); +out: + if (dict) + dict_unref (dict); + free (xlator_req.input.input_val); // malloced by xdr + if (output) + dict_unref (output); + free (xlator_req.name); //malloced by xdr + + return ret; + +} +int glusterfs_handle_rpc_msg (rpcsvc_request_t *req) { int ret = -1; @@ -1187,6 +1264,7 @@ rpcsvc_actor_t glusterfs_actors[] = { [GLUSTERD_BRICK_XLATOR_DEFRAG] = {"TRANSLATOR DEFRAG", GLUSTERD_BRICK_XLATOR_DEFRAG, glusterfs_handle_defrag, NULL, 0, DRC_NA}, [GLUSTERD_NODE_PROFILE] = {"NFS PROFILE", GLUSTERD_NODE_PROFILE, glusterfs_handle_nfs_profile, NULL, 0, DRC_NA}, [GLUSTERD_NODE_STATUS] = {"NFS STATUS", GLUSTERD_NODE_STATUS, glusterfs_handle_node_status, NULL, 0, DRC_NA}, + [GLUSTERD_VOLUME_BARRIER_OP] = {"VOLUME BARRIER OP", GLUSTERD_VOLUME_BARRIER_OP, glusterfs_handle_volume_barrier_op, NULL, 0, DRC_NA}, }; struct rpcsvc_program glusterfs_mop_prog = { diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index a2fd48db5..98f512522 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -460,6 +460,7 @@ typedef enum { GF_EVENT_AUTH_FAILED, GF_EVENT_VOLUME_DEFRAG, GF_EVENT_PARENT_DOWN, + GF_EVENT_VOLUME_BARRIER_OP, GF_EVENT_MAXVAL, } glusterfs_event_t; diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h index 9aadbcaec..f5dc6f29f 100644 --- a/libglusterfs/src/mem-types.h +++ b/libglusterfs/src/mem-types.h @@ -117,6 +117,9 @@ enum gf_common_mem_types_ { gf_common_mt_locker = 101, gf_common_mt_auxgids = 102, gf_common_mt_syncopctx = 103, - gf_common_mt_end = 104 + gf_common_mt_uuid_t = 104, + gf_common_mt_vol_lock_obj_t = 105, + gf_common_mt_txn_opinfo_obj_t = 106, + gf_common_mt_end = 107 }; #endif diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index 33bf2c541..e1a0b2c17 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -192,6 +192,7 @@ enum glusterd_brick_procnum { GLUSTERD_BRICK_XLATOR_DEFRAG, GLUSTERD_NODE_PROFILE, GLUSTERD_NODE_STATUS, + GLUSTERD_VOLUME_BARRIER_OP, GLUSTERD_BRICK_MAXVALUE, }; diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 7a0b7fc90..7ad63bde5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -694,6 +694,11 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo) if (ret) goto out; } + snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->snap_max_limit); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAP_MAX_LIMIT, + buf); + if (ret) + goto out; out: if (ret) @@ -1698,11 +1703,7 @@ glusterd_store_volinfo_atomic_update (glusterd_volinfo_t *volinfo) ret = gf_store_rename_tmppath (volinfo->shandle); if (ret) goto out; - snprintf (buf, sizeof (buf), "%"PRIu64, volinfo->snap_max_limit); - ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAP_MAX_LIMIT, - buf); - if (ret) - goto out; + out: if (ret) gf_log (THIS->name, GF_LOG_ERROR, "Couldn't rename " diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 03e3ec37f..ff23959ec 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -1004,14 +1004,12 @@ gf_barrier_dequeue (gf_barrier_t *barrier) if (!barrier || list_empty (&barrier->queue)) return NULL; - LOCK (&barrier->lock); - { - payload = list_entry (barrier->queue.next, - gf_barrier_payload_t, list); + payload = list_entry (barrier->queue.next, + gf_barrier_payload_t, list); + if (payload) { list_del_init (&payload->list); barrier->cur_size--; } - UNLOCK (&barrier->lock); return payload; } @@ -1029,17 +1027,20 @@ gf_barrier_dequeue_start (void *data) return; barrier = conf->barrier; - - while (!list_empty (&barrier->queue)) { - payload = gf_barrier_dequeue (barrier); - if (payload) { - if (gf_barrier_transmit (conf, payload)) { - gf_log ("server", GF_LOG_WARNING, - "Failed to transmit"); + LOCK (&barrier->lock); + { + while (barrier->cur_size) { + payload = gf_barrier_dequeue (barrier); + if (payload) { + if (gf_barrier_transmit (conf, payload)) { + gf_log ("server", GF_LOG_WARNING, + "Failed to transmit"); + } + GF_FREE (payload); } - GF_FREE (payload); } } + UNLOCK (&barrier->lock); return; } @@ -1055,6 +1056,7 @@ gf_barrier_timeout (void *data) goto out; barrier = conf->barrier; + gf_log ("", GF_LOG_INFO, "barrier timed-out"); LOCK (&barrier->lock); { need_dequeue = barrier->on; @@ -1085,6 +1087,7 @@ gf_barrier_start (xlator_t *this) barrier = conf->barrier; + gf_log (this->name, GF_LOG_INFO, "barrier start called"); LOCK (&barrier->lock); { /* if barrier is on, reset timer */ @@ -1134,6 +1137,7 @@ gf_barrier_stop (xlator_t *this) barrier = conf->barrier; + gf_log (this->name, GF_LOG_INFO, "barrier stop called"); LOCK (&barrier->lock); { need_dequeue = barrier->on; @@ -1205,6 +1209,7 @@ done: { barrier->fops = fops; } + UNLOCK (&barrier->lock); ret = 0; GF_FREE (dup_str); |