summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-server
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2017-05-04 20:56:43 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2017-05-08 05:49:49 +0000
commit21115ae8b80c1ae0afe8427423ca5ecde40f0027 (patch)
tree61fec41d60171cb50e11dcc9ac206899961602db /xlators/features/snapview-server
parent67598f538efb24a9e5ac561b294a05e707e15761 (diff)
snapview-server : Refresh the snapshot list during each reconnect
Currently we are refreshing the snapshot list either when there is a request from glusterd or the very first initialization. But if anything changed after when glusterd is down then there is no mechanism to refresh the snashot dentries. This patch will refresh snapshot list during each reconnect Change-Id: I3ed655572d777f60d57dd479d190f75553591267 BUG: 1448150 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: https://review.gluster.org/17178 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/snapview-server')
-rw-r--r--xlators/features/snapview-server/src/snapview-server-mgmt.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server-mgmt.c b/xlators/features/snapview-server/src/snapview-server-mgmt.c
index fc2ff2ab10d..18c902dca1d 100644
--- a/xlators/features/snapview-server/src/snapview-server-mgmt.c
+++ b/xlators/features/snapview-server/src/snapview-server-mgmt.c
@@ -49,6 +49,31 @@ rpc_clnt_prog_t svs_clnt_handshake_prog = {
.procnames = clnt_handshake_procs,
};
+static int
+svs_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
+ void *data)
+{
+ xlator_t *this = NULL;
+ int ret = 0;
+
+ this = mydata;
+
+ switch (event) {
+ case RPC_CLNT_CONNECT:
+ ret = svs_get_snapshot_list (this);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Error in refreshing the snaplist "
+ "infrastructure");
+ ret = -1;
+ }
+ break;
+ default:
+ break;
+ }
+ return ret;
+}
+
int
svs_mgmt_init (xlator_t *this)
{
@@ -86,6 +111,13 @@ svs_mgmt_init (xlator_t *this)
goto out;
}
+ ret = rpc_clnt_register_notify (priv->rpc, svs_rpc_notify, this);
+ if (ret) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to register notify function");
+ goto out;
+ }
+
ret = rpcclnt_cbk_program_register (priv->rpc, &svs_cbk_prog,
this);
if (ret) {