From 54b8d503dd23e72ed3076988c52e689f3554ebc8 Mon Sep 17 00:00:00 2001 From: Rajesh Amaravathi Date: Thu, 19 Jan 2012 18:09:34 +0530 Subject: pump: move internal pump xattrs out of trusted domain * the trusted.glusterfs.pump.{start|pause|commit|status|abort} xattrs have been moved out of trusted domain. This enables separation of xattrs used as gluster-internal commands (handled by pump) for replace-brick, which are not set in the back-end, from xattrs set on the replace-brick source and destinations bricks. * macros definitions from pump.h and glusterd.h, #defining these xattrs have been merged and put into libglusterfs/src/glusterfs.h Change-Id: I87b8bfbf045aa140f5d3f0c9baa9b2e79f87b67b BUG: 783049 Signed-off-by: Rajesh Amaravathi Reviewed-on: http://review.gluster.com/2663 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- libglusterfs/src/glusterfs.h | 7 +++++++ xlators/cluster/afr/src/pump.c | 17 +++++++++-------- xlators/cluster/afr/src/pump.h | 6 ------ xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 11 ++++++----- xlators/mgmt/glusterd/src/glusterd.h | 7 +------ 5 files changed, 23 insertions(+), 25 deletions(-) diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index c5c0a6261d..903d2324a0 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -93,6 +93,13 @@ #define GLUSTERFS_POSIXLK_COUNT "glusterfs.posixlk-count" #define QUOTA_SIZE_KEY "trusted.glusterfs.quota.size" +/* replace-brick and pump related internal xattrs */ +#define RB_PUMP_CMD_START "glusterfs.pump.start" +#define RB_PUMP_CMD_PAUSE "glusterfs.pump.pause" +#define RB_PUMP_CMD_COMMIT "glusterfs.pump.commit" +#define RB_PUMP_CMD_ABORT "glusterfs.pump.abort" +#define RB_PUMP_CMD_STATUS "glusterfs.pump.status" + #define GLUSTERFS_RDMA_INLINE_THRESHOLD (2048) #define GLUSTERFS_RDMA_MAX_HEADER_SIZE (228) /* (sizeof (rdma_header_t) \ + RDMA_MAX_SEGMENTS \ diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index 8044fb85bf..b92c50e851 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -29,6 +29,7 @@ #include "afr-common.c" #include "defaults.c" +#include "glusterfs.h" static uint64_t pump_pid = 0; static int @@ -796,7 +797,7 @@ pump_initiate_sink_connect (call_frame_t *frame, xlator_t *this) afr_build_root_loc (priv->root_inode, &loc); - data = data_ref (dict_get (local->dict, PUMP_CMD_START)); + data = data_ref (dict_get (local->dict, RB_PUMP_CMD_START)); if (!data) { ret = -1; gf_log (this->name, GF_LOG_ERROR, @@ -972,7 +973,7 @@ pump_execute_status (call_frame_t *frame, xlator_t *this) dict = dict_new (); - ret = dict_set_dynstr (dict, PUMP_CMD_STATUS, dict_str); + ret = dict_set_dynstr (dict, RB_PUMP_CMD_STATUS, dict_str); if (ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "dict_set_dynstr returned negative value"); @@ -1151,7 +1152,7 @@ pump_command_status (xlator_t *this, dict_t *dict) int dict_ret = -1; int ret = _gf_true; - dict_ret = dict_get_str (dict, PUMP_CMD_STATUS, &cmd); + dict_ret = dict_get_str (dict, RB_PUMP_CMD_STATUS, &cmd); if (dict_ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "Not a pump status command"); @@ -1175,7 +1176,7 @@ pump_command_pause (xlator_t *this, dict_t *dict) int dict_ret = -1; int ret = _gf_true; - dict_ret = dict_get_str (dict, PUMP_CMD_PAUSE, &cmd); + dict_ret = dict_get_str (dict, RB_PUMP_CMD_PAUSE, &cmd); if (dict_ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "Not a pump pause command"); @@ -1199,7 +1200,7 @@ pump_command_commit (xlator_t *this, dict_t *dict) int dict_ret = -1; int ret = _gf_true; - dict_ret = dict_get_str (dict, PUMP_CMD_COMMIT, &cmd); + dict_ret = dict_get_str (dict, RB_PUMP_CMD_COMMIT, &cmd); if (dict_ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "Not a pump commit command"); @@ -1223,7 +1224,7 @@ pump_command_abort (xlator_t *this, dict_t *dict) int dict_ret = -1; int ret = _gf_true; - dict_ret = dict_get_str (dict, PUMP_CMD_ABORT, &cmd); + dict_ret = dict_get_str (dict, RB_PUMP_CMD_ABORT, &cmd); if (dict_ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "Not a pump abort command"); @@ -1247,7 +1248,7 @@ pump_command_start (xlator_t *this, dict_t *dict) int dict_ret = -1; int ret = _gf_true; - dict_ret = dict_get_str (dict, PUMP_CMD_START, &cmd); + dict_ret = dict_get_str (dict, RB_PUMP_CMD_START, &cmd); if (dict_ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "Not a pump start command"); @@ -1409,7 +1410,7 @@ pump_getxattr (call_frame_t *frame, xlator_t *this, goto out; } - if (!strcmp (name, PUMP_CMD_STATUS)) { + if (!strcmp (name, RB_PUMP_CMD_STATUS)) { gf_log (this->name, GF_LOG_DEBUG, "Hit pump command - status"); pump_execute_status (frame, this); diff --git a/xlators/cluster/afr/src/pump.h b/xlators/cluster/afr/src/pump.h index 9d60e5bea5..4213a635ed 100644 --- a/xlators/cluster/afr/src/pump.h +++ b/xlators/cluster/afr/src/pump.h @@ -26,12 +26,6 @@ #define CLIENT_CMD_CONNECT "trusted.glusterfs.client-connect" #define CLIENT_CMD_DISCONNECT "trusted.glusterfs.client-disconnect" -#define PUMP_CMD_START "trusted.glusterfs.pump.start" -#define PUMP_CMD_COMMIT "trusted.glusterfs.pump.commit" -#define PUMP_CMD_ABORT "trusted.glusterfs.pump.abort" -#define PUMP_CMD_PAUSE "trusted.glusterfs.pump.pause" -#define PUMP_CMD_STATUS "trusted.glusterfs.pump.status" - #define PUMP_SOURCE_COMPLETE "trusted.glusterfs.pump-source-complete" #define PUMP_SINK_COMPLETE "trusted.glusterfs.pump-sink-complete" diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index dfa9b5dd31..07da382c7c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -25,6 +25,7 @@ #include "common-utils.h" #include "cli1-xdr.h" #include "xdr-generic.h" +#include "glusterfs.h" #include "glusterd.h" #include "glusterd-op-sm.h" #include "glusterd-store.h" @@ -1083,7 +1084,7 @@ rb_do_operation_start (glusterd_volinfo_t *volinfo, ret = rb_send_xattr_command (volinfo, src_brickinfo, - dst_brickinfo, RB_PUMP_START_CMD, + dst_brickinfo, RB_PUMP_CMD_START, start_value); if (ret) { gf_log ("", GF_LOG_DEBUG, @@ -1128,7 +1129,7 @@ rb_do_operation_pause (glusterd_volinfo_t *volinfo, "mounted the replace brick client"); ret = rb_send_xattr_command (volinfo, src_brickinfo, - dst_brickinfo, RB_PUMP_PAUSE_CMD, + dst_brickinfo, RB_PUMP_CMD_PAUSE, "jargon"); if (ret) { gf_log ("", GF_LOG_DEBUG, @@ -1201,7 +1202,7 @@ rb_do_operation_commit (glusterd_volinfo_t *volinfo, "mounted the replace brick client"); cmd_ret = rb_send_xattr_command (volinfo, src_brickinfo, - dst_brickinfo, RB_PUMP_COMMIT_CMD, + dst_brickinfo, RB_PUMP_CMD_COMMIT, "jargon"); if (cmd_ret) { gf_log ("", GF_LOG_DEBUG, @@ -1247,7 +1248,7 @@ rb_do_operation_abort (glusterd_volinfo_t *volinfo, "mounted the replace brick client"); ret = rb_send_xattr_command (volinfo, src_brickinfo, - dst_brickinfo, RB_PUMP_ABORT_CMD, + dst_brickinfo, RB_PUMP_CMD_ABORT, "jargon"); if (ret) { gf_log ("", GF_LOG_DEBUG, @@ -1353,7 +1354,7 @@ rb_do_operation_status (glusterd_volinfo_t *volinfo, "mounted the replace brick client"); ret = rb_get_xattr_command (volinfo, src_brickinfo, - dst_brickinfo, RB_PUMP_STATUS_CMD, + dst_brickinfo, RB_PUMP_CMD_STATUS, status); if (ret) { gf_log ("", GF_LOG_DEBUG, diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 4723aec79c..6e96192506 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -263,12 +263,7 @@ enum glusterd_vol_comp_status_ { #define GLUSTERD_BRICK_INFO_DIR "bricks" #define GLUSTERD_CKSUM_FILE "cksum" -/*All definitions related to replace brick */ -#define RB_PUMP_START_CMD "trusted.glusterfs.pump.start" -#define RB_PUMP_PAUSE_CMD "trusted.glusterfs.pump.pause" -#define RB_PUMP_COMMIT_CMD "trusted.glusterfs.pump.commit" -#define RB_PUMP_ABORT_CMD "trusted.glusterfs.pump.abort" -#define RB_PUMP_STATUS_CMD "trusted.glusterfs.pump.status" +/* definitions related to replace brick */ #define RB_CLIENT_MOUNTPOINT "rb_mount" #define RB_CLIENTVOL_FILENAME "rb_client.vol" #define RB_DSTBRICK_PIDFILE "rb_dst_brick.pid" -- cgit