1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
$NetBSD: patch-10963,v 1.1 2015/06/02 03:44:16 manu Exp $
From upstream http://review.gluster.org/10963
From 5c359a79bd3c978d0f636082871c289c717d354e Mon Sep 17 00:00:00 2001
From: Krishnan Parthasarathi <kparthas@redhat.com>
Date: Tue, 19 May 2015 14:48:01 +0530
Subject: [PATCH] glusterd: fix repeated connection to nfssvc failed msgs
... and disable reconnect timer on rpc_clnt_disconnect.
Root Cause
----------
gluster-NFS service wouldn't be started if there are no
started volumes that have nfs service enabled for them.
Before this fix we would initiate a connect even when
the gluster-NFS service wasn't (re)started. Compounding
that glusterd_conn_disconnect doesn't disable reconnect
timer. So, it is possible that the reconnect timer was
in execution when the timer event was attempted to be
removed.
Change-Id: Iadcb5cff9eafefa95eaf3a1a9413eeb682d3aaac
BUG: 1222065
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/10830
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
---
diff --git rpc/rpc-lib/src/rpc-clnt.c rpc/rpc-lib/src/rpc-clnt.c
index 264a312..db99484 100644
--- rpc/rpc-lib/src/rpc-clnt.c
+++ rpc/rpc-lib/src/rpc-clnt.c
@@ -1108,6 +1108,11 @@
conn = &rpc->conn;
+ pthread_mutex_lock (&conn->lock);
+ {
+ rpc->disabled = 0;
+ }
+ pthread_mutex_unlock (&conn->lock);
rpc_clnt_reconnect (conn);
return 0;
@@ -1758,6 +1763,7 @@
pthread_mutex_lock (&conn->lock);
{
+ rpc->disabled = 1;
if (conn->timer) {
gf_timer_call_cancel (rpc->ctx, conn->timer);
conn->timer = NULL;
diff --git xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
index da8c909..fca9323 100644
--- xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
+++ xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
@@ -80,7 +80,6 @@
int
glusterd_conn_term (glusterd_conn_t *conn)
{
- rpc_clnt_disable (conn->rpc);
rpc_clnt_unref (conn->rpc);
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index 49b1b56..cb08a20 100644
--- xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -164,18 +164,15 @@
{
int ret = -1;
- if (glusterd_are_all_volumes_stopped ()) {
- ret = svc->stop (svc, SIGKILL);
+ ret = svc->stop (svc, SIGKILL);
+ if (ret)
+ goto out;
- } else {
- ret = glusterd_nfssvc_create_volfile ();
- if (ret)
- goto out;
+ ret = glusterd_nfssvc_create_volfile ();
+ if (ret)
+ goto out;
- ret = svc->stop (svc, SIGKILL);
- if (ret)
- goto out;
-
+ if (glusterd_nfssvc_need_start ()) {
ret = svc->start (svc, flags);
if (ret)
goto out;
@@ -192,10 +189,9 @@
int
glusterd_nfssvc_start (glusterd_svc_t *svc, int flags)
{
- if (glusterd_nfssvc_need_start ())
- return glusterd_svc_start (svc, flags, NULL);
+ return glusterd_svc_start (svc, flags, NULL);
return 0;
}
|