summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2017-07-17 16:43:43 +0200
committerShyamsundar Ranganathan <srangana@redhat.com>2017-08-11 10:52:07 +0000
commit0710984e457786e750847b7119a6e10919973e6a (patch)
tree4a35752794c11f1aff44f8862bd11b2301e613b1 /xlators
parent6c2077618d336edea299d946084ebb4edbbfd47e (diff)
nfs/nlm: unref fds in nlm_client_free()
When a nlm_clnt is getting free'd, the FDs associated with this client should be unref'd as well. Cherry picked from commit e9a482f94e748ea12e73ddd2e275bad9aa314b4c: > Change-Id: Ifa4ea4b7ed45a454413cfc0c820f2516c534a9aa > BUG: 1467313 > Signed-off-by: Niels de Vos <ndevos@redhat.com> > Reviewed-on: https://review.gluster.org/17697 > Smoke: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Amar Tumballi <amarts@redhat.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> > Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Change-Id: Ifa4ea4b7ed45a454413cfc0c820f2516c534a9aa BUG: 1471870 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: https://review.gluster.org/17793 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/nfs/server/src/nlm4.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index dc7d23dbef5..f57df4eb665 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -329,6 +329,17 @@ ret:
static void
nlm_client_free (nlm_client_t *nlmclnt)
{
+ nlm_fde_t *fde = NULL, *tmp = NULL;
+
+ gf_msg_trace (GF_NLM, 0, "removing nlm-client %s from the list",
+ nlmclnt->caller_name);
+
+ list_for_each_entry_safe (fde, tmp, &nlmclnt->fdes, fde_list) {
+ fd_unref (fde->fd);
+ list_del (&fde->fde_list);
+ GF_FREE (fde);
+ }
+
list_del (&nlmclnt->fdes);
list_del (&nlmclnt->nlm_clients);
list_del (&nlmclnt->shares);
@@ -1176,7 +1187,6 @@ int
nlm_cleanup_fds (char *caller_name)
{
int nlmclnt_found = 0;
- nlm_fde_t *fde = NULL, *tmp = NULL;
nlm_client_t *nlmclnt = NULL;
LOCK (&nlm_client_list_lk);
@@ -1191,15 +1201,7 @@ nlm_cleanup_fds (char *caller_name)
if (!nlmclnt_found)
goto ret;
- if (list_empty (&nlmclnt->fdes))
- goto ret;
-
- list_for_each_entry_safe (fde, tmp, &nlmclnt->fdes, fde_list) {
- fd_unref (fde->fd);
- list_del (&fde->fde_list);
- GF_FREE (fde);
- }
-
+ nlm_client_free (nlmclnt);
ret:
UNLOCK (&nlm_client_list_lk);
return 0;
@@ -1240,9 +1242,6 @@ nlm_search_and_delete (fd_t *fd, nlm4_lock *lk)
goto ret;
list_del (&fde->fde_list);
- if (list_empty (&nlmclnt->fdes) && list_empty (&nlmclnt->shares))
- nlm_client_free (nlmclnt);
-
ret:
UNLOCK (&nlm_client_list_lk);