From b99e0e06788380e41d6c08ea308a6dd87a7afdfe Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Wed, 23 Feb 2011 03:38:36 +0000 Subject: mgmt/Glusterd: while resetting the volume options, the previous data structures w.r.t auth. must be deleted Signed-off-by: Kaushik BV Signed-off-by: Anand V. Avati BUG: 2374 ([glusterfs 3.1.2] gluster volume set auth.reject command failure on nfs) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2374 --- glusterfsd/src/glusterfsd-mgmt.c | 2 ++ xlators/protocol/server/src/server.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 95ab7b98fcb..a6d8a480076 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -371,6 +371,8 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, if (ret == 0) { gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG, "No need to re-load volfile, reconfigure done"); + oldvollen = size; + memcpy (oldvolfile, rsp.spec, size); goto out; } diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 87e78880fa8..650b66bf1de 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -526,6 +526,25 @@ out: return ret; } +static void +_delete_auth_opt (dict_t *this, + char *key, + data_t *value, + void *data) +{ + char *auth_option_pattern[] = { "auth.addr.*.allow", + "auth.addr.*.reject"}; + if (fnmatch ( auth_option_pattern[0], key, 0) != 0) { + dict_del (this, key); + return; + } + + if (fnmatch ( auth_option_pattern[1], key, 0) != 0) { + dict_del (this, key); + return; + } +} + static void _copy_auth_opt (dict_t *unused, @@ -537,7 +556,7 @@ _copy_auth_opt (dict_t *unused, "auth.addr.*.reject"}; if (fnmatch ( auth_option_pattern[0], key, 0) != 0) dict_set ((dict_t *)xl_dict, key, (value)); - + if (fnmatch ( auth_option_pattern[1], key, 0) != 0) dict_set ((dict_t *)xl_dict, key, (value)); } @@ -575,12 +594,12 @@ reconfigure (xlator_t *this, dict_t *options) "'trace' takes on only boolean values. " "Neglecting option"); ret = -1; - goto out; + goto out; } conf->trace = trace; gf_log (this->name, GF_LOG_TRACE, "Reconfigured trace" " to %d", conf->trace); - + } if (!conf->auth_modules) conf->auth_modules = dict_new (); @@ -591,14 +610,15 @@ reconfigure (xlator_t *this, dict_t *options) /* logging already done in validate_auth_options function. */ goto out; } - dict_foreach (options, _copy_auth_opt, this->options); + dict_foreach (this->options, _delete_auth_opt, this->options); + dict_foreach (options, _copy_auth_opt, this->options); ret = gf_auth_init (this, conf->auth_modules); if (ret) { dict_unref (conf->auth_modules); goto out; } - + rpc_conf = conf->rpc; if (!rpc_conf) { gf_log (this->name, GF_LOG_ERROR, "No rpc_conf !!!!"); @@ -607,10 +627,10 @@ reconfigure (xlator_t *this, dict_t *options) list_for_each_entry (listeners, &(rpc_conf->listeners), list) { if (listeners->trans != NULL) { - if (listeners->trans->reconfigure ) + if (listeners->trans->reconfigure ) listeners->trans->reconfigure (listeners->trans, options); else - gf_log (this->name, GF_LOG_ERROR, + gf_log (this->name, GF_LOG_ERROR, "Reconfigure not found for transport" ); } } -- cgit