From a5fc34604aef973606431bf7d873abb91ee03d5a Mon Sep 17 00:00:00 2001 From: Meghana Madhusudhan Date: Tue, 5 May 2015 18:19:51 +0530 Subject: Cache-invalidation : set to on/off depending on ganesha.enable value Multi-Head NFS-Ganesha servers need upcall (cache-invalidation) support to notify them in case of any changes to the files in the backend. Hence, upcall xlator option "features.cache-invalidation" needs to be enabled when ganesha.enable is set to 'on'. Similarly, this feature needs to be disabled when ganesha.enable is set to 'off' Signed-off-by: Meghana Madhusudhan Change-Id: Ifdd1d50e48a2bd2a388f73c0b9e318c6092ac190 BUG: 1213752 Reviewed-on: http://review.gluster.org/10581 Reviewed-by: soumya k Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- extras/ganesha/scripts/create-export-ganesha.sh | 3 +++ xlators/mgmt/glusterd/src/glusterd-ganesha.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh index de869c4629d..48c0ea5c16c 100755 --- a/extras/ganesha/scripts/create-export-ganesha.sh +++ b/extras/ganesha/scripts/create-export-ganesha.sh @@ -53,4 +53,7 @@ echo " }" } write_conf $@ > $GANESHA_DIR/exports/export.$VOL.conf +if ! (cat $CONF | grep $VOL.conf$ ) +then echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF +fi diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c index b4375aa26c2..a200a64d7c6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c +++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c @@ -419,6 +419,7 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr) int ret = -1; char str[1024]; glusterd_volinfo_t *volinfo = NULL; + dict_t *vol_opts = NULL; char *volname = NULL; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; @@ -500,11 +501,21 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr) runner_add_args (&runner, "sh", GANESHA_PREFIX"/dbus-send.sh", CONFDIR, value, volname, NULL); ret = runner_run (&runner); - if (ret) + if (ret) { gf_asprintf(op_errstr, "Dynamic export" " addition/deletion failed." " Please see log file for details"); + goto out; + } } + /* cache-invalidation should be on when a volume is exported + * and off when a volume is unexported. */ + vol_opts = volinfo->dict; + ret = dict_set_dynstr_with_alloc (vol_opts, + "features.cache-invalidation", value); + if (ret) + gf_asprintf (op_errstr, "Cache-invalidation could not" + " be set to %s.", value); out: return ret; } -- cgit