diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-02-23 03:38:36 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-03-01 00:27:08 -0800 |
commit | b99e0e06788380e41d6c08ea308a6dd87a7afdfe (patch) | |
tree | a8aa679a132baf7d505be4c649915ea08f922be1 | |
parent | 156e1e26d76d4b62ad1fae15938a1350c9bc892a (diff) |
mgmt/Glusterd: while resetting the volume options, the previous data structures w.r.t auth. must be deletedv3.1.3qa1
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
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
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 2 | ||||
-rw-r--r-- | 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 95ab7b98f..a6d8a4800 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 87e78880f..650b66bf1 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" ); } } |