From 9189ed3201f1da89f16595d685b67a71e075d5be Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Fri, 10 Jan 2020 08:24:35 +0200 Subject: glusterd-volgen.c: fix to disable property when gNFS disabled. The code was not ifdef'ed properly when gNFS was not enabled. Strangely, I could not reproduce the failure on my system (Fedora 31), but it was reproduced elsehwere and the fix was verified to correct it. The failure: gluster volume create testvol replica 3 127.0.0.2:/tests/brick{1..3} force gluster v set testvol write-behind off grep -rne write-behind /var/lib/glusterd/vols/testvol/trusted-testvol.tcp-fuse.vol The last grep was supposed to come out empty. The issue was that perfxl_option_handler may not have been called when it should have been. Change-Id: Ie9f8ec87dabeef6624527c2266ddf9af01ca7373 updates: bz#1193929 Signed-off-by: Yaniv Kaul --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 45f6d7ab32e..d9e5e865fbd 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2758,6 +2758,7 @@ gfproxy_client_perfxl_option_handler(volgen_graph_t *graph, return 0; } +#ifdef BUILD_GNFS static int nfsperfxl_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme, void *param) @@ -2780,6 +2781,7 @@ nfsperfxl_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme, else return -1; } +#endif #if (HAVE_LIB_XML) int @@ -3880,7 +3882,6 @@ static int client_graph_set_perf_options(volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict) { - char *volname = NULL; int ret = 0; /* @@ -3909,18 +3910,19 @@ client_graph_set_perf_options(volgen_graph_t *graph, if (ret < 0) return ret; - volname = volinfo->volname; - #ifdef BUILD_GNFS data_t *tmp_data = NULL; + char *volname = NULL; + tmp_data = dict_get_sizen(set_dict, "nfs-volume-file"); - if (!tmp_data) - return volgen_graph_set_options_generic(graph, set_dict, volinfo, - &perfxl_option_handler); - else -#endif + if (tmp_data) { + volname = volinfo->volname; return volgen_graph_set_options_generic(graph, set_dict, volname, &nfsperfxl_option_handler); + } else +#endif + return volgen_graph_set_options_generic(graph, set_dict, volinfo, + &perfxl_option_handler); } static int -- cgit