diff options
author | Jiffin Tony Thottan <jthottan@redhat.com> | 2016-06-23 11:56:10 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2016-06-23 06:39:24 -0700 |
commit | 16c34b101f604a09a5c735fb39815c59ee4ecbdb (patch) | |
tree | 777e94415eb0b865b9c3f748d8504d21591ad49d /xlators/mgmt | |
parent | 6680b844c5a31bdb3b0c4c6a831218aecd45fd6c (diff) |
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().
Change-Id: Ib843ac30adb28a70e13a9a1df57020ef2f3db8a4
BUG: 1349270
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: http://review.gluster.org/14778
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-ganesha.c | 27 |
1 files changed, 25 insertions, 2 deletions
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; |