From a279af40f11a437fabc5b59234e677282bea246b Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Mon, 8 Aug 2011 15:13:57 +0530 Subject: mgmt/glusterd: volume set help/help-xml minor fixes - fix few typos in description - fix the memory leak - add an explicit flush call to flush the contents of xmlWriter to buffer Change-Id: Iae58b117361e3701ee31fbd65890734312289203 BUG: 2041 Reviewed-on: http://review.gluster.com/191 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/xlator.c | 6 +++--- xlators/mgmt/glusterd/src/glusterd-volgen.c | 24 +++++++++++++++++++++++- xlators/nfs/server/src/nfs.c | 7 ++++--- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 81b308d33..7db671d6d 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -605,8 +605,6 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle, } *dl_handle = handle; - INIT_LIST_HEAD (&opt_list->list); - vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t), gf_common_mt_volume_opt_list_t); @@ -619,10 +617,12 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle, gf_log ("xlator", GF_LOG_DEBUG, "Strict option validation not enforced -- neglecting"); } - list_add_tail (&vol_opt->list, &opt_list->list); + list_add (&vol_opt->list, &opt_list->list); ret = 0; out: + if (name) + GF_FREE (name); gf_log ("xlator", GF_LOG_DEBUG, "Returning %d", ret); return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 1c0d1c11d..61a485202 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1332,6 +1332,16 @@ end_sethelp_xml_doc (xmlTextWriterPtr writer) ret = -1; goto out; } + + ret = xmlTextWriterFlush (writer); + if (ret < 0) { + gf_log ("glusterd", GF_LOG_ERROR, "Could not flush an " + "xmlDocument"); + ret = -1; + goto out; + } + + ret = 0; out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); @@ -1492,7 +1502,9 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) char *xlator_type = NULL; void *dl_handle = NULL; - volume_opt_list_t vol_opt_handle; + volume_opt_list_t vol_opt_handle; + volume_opt_list_t *vol_opt = NULL; + volume_opt_list_t *tmp = NULL; char *key = NULL; struct volopt_map_entry *vme = NULL; int ret = -1; @@ -1521,6 +1533,8 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) goto out; } + INIT_LIST_HEAD (&vol_opt_handle.list); + for (vme = &glusterd_volopt_map[0]; vme->key; vme++) { if ( ( vme->type == NO_DOC) || (vme->type == GLOBAL_NO_DOC) ) @@ -1572,6 +1586,9 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) else #if (HAVE_LIB_XML) output = gf_strdup ((char *)buf->content); + xmlFreeTextWriter (writer); + xmlBufferFree (buf); + #else gf_log ("glusterd", GF_LOG_ERROR, "Libxml not present"); #endif @@ -1583,6 +1600,11 @@ glusterd_get_volopt_content (gf_boolean_t xml_out) ret = dict_set_dynstr (ctx, "help-str", output); out: + list_for_each_entry_safe (vol_opt, tmp, &vol_opt_handle.list, list) { + list_del_init (&vol_opt->list); + GF_FREE (vol_opt); + } + gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 97a33531b..699b0f441 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -827,7 +827,7 @@ struct volume_options options[] = { .description = "All writes and COMMIT requests are treated as async." " This implies that no write requests are guaranteed" " to be on server disks when the write reply is " - "received at the NFS client. Trusted sync includes " + "received at the NFS client. Trusted sync includes" " trusted-write behaviour. Off by default." }, @@ -887,6 +887,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.auth-null.*"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "", .description = "Disable or enable the AUTH_NULL authentication type " "for a particular exported volume over-riding defaults" " and general setting for AUTH_NULL. Must always be " @@ -907,7 +908,7 @@ struct volume_options options[] = { .description = "Reject a comma separated list of addresses and/or" " hostnames from connecting to the server. By default," " all connections are disallowed. This allows users to" - "define a general rule for all exported volumes." + " define a general rule for all exported volumes." }, { .key = {"rpc-auth.addr.*.allow"}, .type = GF_OPTION_TYPE_STR, @@ -923,7 +924,7 @@ struct volume_options options[] = { .description = "Reject a comma separated list of addresses and/or" " hostnames from connecting to the server. By default," " all connections are disallowed. This allows users to" - "define a rule for a specific exported volume." + " define a rule for a specific exported volume." }, { .key = {"rpc-auth.ports.insecure"}, .type = GF_OPTION_TYPE_BOOL, -- cgit