From 3541810cdf6bc3914c4f7531500bc0ae32954f84 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Thu, 23 Jun 2016 11:56:10 +0530 Subject: glusterd/ganesha : persist value set by teardown in info file During teardown, all the volumes exported via NFS-Ganesha will be unexported. So all related volume options need to reset. Currently this change made using dict_set on volopt dictionary, i.e change is only reflected in memory not persisted in the volume info file Therefore incase of glusterd restart this data can be lost. Also this patch fix similar issue in ganesha_manage_export(). Upstream reference : >Change-Id: Ib843ac30adb28a70e13a9a1df57020ef2f3db8a4 >BUG: 1349270 >Signed-off-by: Jiffin Tony Thottan >Reviewed-on: http://review.gluster.org/14778 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Kaleb KEITHLEY >Reviewed-by: Atin Mukherjee >(cherry picked from commit 16c34b101f604a09a5c735fb39815c59ee4ecbdb) Change-Id: Ib843ac30adb28a70e13a9a1df57020ef2f3db8a4 BUG: 1351151 Signed-off-by: Jiffin Tony Thottan Reviewed-on: http://review.gluster.org/14831 Reviewed-by: Atin Mukherjee Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-ganesha.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c index 8d26216d908..d34ec05c5f5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c +++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c @@ -624,6 +624,12 @@ ganesha_manage_export (char *volname, char *value, char **op_errstr, if (ret && op_errstr) gf_asprintf (op_errstr, "Cache-invalidation could not" " be set to %s.", value); + ret = glusterd_store_volinfo (volinfo, + GLUSTERD_VOLINFO_VER_AC_INCREMENT); + if (ret && op_errstr) + gf_asprintf (op_errstr, "failed to store volinfo for %s" + , volinfo->volname); + } out: return ret; @@ -696,12 +702,29 @@ teardown (char **op_errstr) cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) { vol_opts = volinfo->dict; /* All the volumes exported via NFS-Ganesha will be - unexported, hence setting the appropriate key */ + unexported, hence setting the appropriate keys */ + ret = dict_set_str (vol_opts, "features.cache-invalidation", + "off"); + if (ret) + gf_msg (THIS->name, GF_LOG_WARNING, errno, + GD_MSG_DICT_SET_FAILED, + "Could not set features.cache-invalidation " + "to off for %s", volinfo->volname); + ret = dict_set_str (vol_opts, "ganesha.enable", "off"); if (ret) gf_msg (THIS->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED, - "Could not set ganesha.enable to off"); + "Could not set ganesha.enable to off for %s", + volinfo->volname); + + ret = glusterd_store_volinfo (volinfo, + GLUSTERD_VOLINFO_VER_AC_INCREMENT); + if (ret) + gf_msg (THIS->name, GF_LOG_WARNING, 0, + GD_MSG_VOLINFO_SET_FAIL, + "failed to store volinfo for %s", + volinfo->volname); } out: return ret; -- cgit