|
|
21ab4e |
From 9f9ef4ba6fa7e96581136f3817bb8f0a0c73fade Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Niels de Vos <ndevos@redhat.com>
|
|
|
21ab4e |
Date: Fri, 20 Jan 2017 14:15:31 +0100
|
|
|
21ab4e |
Subject: [PATCH 442/473] nfs/nlm: free the nlm_client upon RPC_DISCONNECT
|
|
|
21ab4e |
|
|
|
21ab4e |
When an NLM client disconnects, it should be removed from the list and
|
|
|
21ab4e |
free'd.
|
|
|
21ab4e |
|
|
|
21ab4e |
> Cherry picked from commit 6897ba5c51b29c05b270c447adb1a34cb8e61911:
|
|
|
21ab4e |
> Change-Id: Ib427c896bfcdc547a3aee42a652578ffd076e2ad
|
|
|
21ab4e |
> BUG: 1381970
|
|
|
21ab4e |
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
|
|
|
21ab4e |
> Reviewed-on: https://review.gluster.org/17189
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: Ib427c896bfcdc547a3aee42a652578ffd076e2ad
|
|
|
21ab4e |
Signed-off-by: Niels de Vos <ndevos@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/106034
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/nfs/server/src/nlm4.c | 32 ++++++++++++++++++++------------
|
|
|
21ab4e |
1 file changed, 20 insertions(+), 12 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
|
|
|
21ab4e |
index 903262e..cff9a3f 100644
|
|
|
21ab4e |
--- a/xlators/nfs/server/src/nlm4.c
|
|
|
21ab4e |
+++ b/xlators/nfs/server/src/nlm4.c
|
|
|
21ab4e |
@@ -45,7 +45,7 @@
|
|
|
21ab4e |
|
|
|
21ab4e |
/* TODO:
|
|
|
21ab4e |
* 1) 2 opens racing .. creating an fd leak.
|
|
|
21ab4e |
- * 2) use mempool for nlmclnt - destroy if no fd exists, create during 1st call
|
|
|
21ab4e |
+ * 2) use GF_REF_* for nlm_clnt_t
|
|
|
21ab4e |
*/
|
|
|
21ab4e |
|
|
|
21ab4e |
typedef ssize_t (*nlm4_serializer) (struct iovec outmsg, void *args);
|
|
|
21ab4e |
@@ -333,6 +333,24 @@ ret:
|
|
|
21ab4e |
return rpc_clnt;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+static void
|
|
|
21ab4e |
+nlm_client_free (nlm_client_t *nlmclnt)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ list_del (&nlmclnt->fdes);
|
|
|
21ab4e |
+ list_del (&nlmclnt->nlm_clients);
|
|
|
21ab4e |
+ list_del (&nlmclnt->shares);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ GF_FREE (nlmclnt->caller_name);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (nlmclnt->rpc_clnt) {
|
|
|
21ab4e |
+ /* cleanup the saved-frames before last unref */
|
|
|
21ab4e |
+ rpc_clnt_connection_cleanup (&nlmclnt->rpc_clnt->conn);
|
|
|
21ab4e |
+ /* rpc_clnt_connection_cleanup() calls rpc_clnt_unref() */
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ GF_FREE (nlmclnt);
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
int
|
|
|
21ab4e |
nlm_set_rpc_clnt (rpc_clnt_t *rpc_clnt, char *caller_name)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
@@ -375,26 +393,16 @@ int
|
|
|
21ab4e |
nlm_unset_rpc_clnt (rpc_clnt_t *rpc)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
nlm_client_t *nlmclnt = NULL;
|
|
|
21ab4e |
- rpc_clnt_t *rpc_clnt = NULL;
|
|
|
21ab4e |
|
|
|
21ab4e |
LOCK (&nlm_client_list_lk);
|
|
|
21ab4e |
list_for_each_entry (nlmclnt, &nlm_client_list, nlm_clients) {
|
|
|
21ab4e |
if (rpc == nlmclnt->rpc_clnt) {
|
|
|
21ab4e |
- rpc_clnt = nlmclnt->rpc_clnt;
|
|
|
21ab4e |
- nlmclnt->rpc_clnt = NULL;
|
|
|
21ab4e |
+ nlm_client_free (nlmclnt);
|
|
|
21ab4e |
break;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
UNLOCK (&nlm_client_list_lk);
|
|
|
21ab4e |
- if (rpc_clnt == NULL) {
|
|
|
21ab4e |
- return -1;
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
- if (rpc_clnt) {
|
|
|
21ab4e |
- /* cleanup the saved-frames before last unref */
|
|
|
21ab4e |
- rpc_clnt_connection_cleanup (&rpc_clnt->conn);
|
|
|
21ab4e |
|
|
|
21ab4e |
- rpc_clnt_unref (rpc_clnt);
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|