3604df
From 6fd60a6935c75fb40f27bb7838be229ffd23ebab Mon Sep 17 00:00:00 2001
3604df
From: Soumya Koduri <skoduri@redhat.com>
3604df
Date: Mon, 13 Feb 2017 16:52:07 +0530
3604df
Subject: [PATCH 289/294] gNFS: Keep the mountdict as long as the service is
3604df
 active
3604df
3604df
We initialize and take ref once on mountdict during NFS/MNT3 server
3604df
initialization but seem to be unref'in it for every UMNTALL request.
3604df
This can lead to crash when there are multiple UMNTALL requests
3604df
with >=1 active mount entry(/ies) in the mountlist.
3604df
3604df
Since we take the ref only once, we should keep the mountdict through
3604df
out the life of the process and dereference it only during unitialization
3604df
of mnt3 service.
3604df
3604df
This is backport of the below mainline fix -
3604df
        https://review.gluster.org/16611
3604df
3604df
>Change-Id: I3238a8df09b8972e56dd93fee426d866d40d9959
3604df
>BUG: 1421759
3604df
>Signed-off-by: Soumya Koduri <skoduri@redhat.com>
3604df
>Reviewed-on: https://review.gluster.org/16611
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
3604df
>Reviewed-by: Niels de Vos <ndevos@redhat.com>
3604df
3604df
BUG: 1315544
3604df
Change-Id: I28b154df57390f66bec37ba9bb3e861d07b76027
3604df
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/97861
3604df
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 xlators/nfs/server/src/mount3.c | 10 +++++++---
3604df
 1 file changed, 7 insertions(+), 3 deletions(-)
3604df
3604df
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
3604df
index 48b719d..b735038 100644
3604df
--- a/xlators/nfs/server/src/mount3.c
3604df
+++ b/xlators/nfs/server/src/mount3.c
3604df
@@ -2544,8 +2544,6 @@ __mnt3svc_umountall (struct mount3_state *ms)
3604df
                 GF_FREE (me);
3604df
         }
3604df
 
3604df
-        dict_unref (ms->mountdict);
3604df
-
3604df
         return 0;
3604df
 }
3604df
 
3604df
@@ -3939,7 +3937,13 @@ mnt3svc_deinit (xlator_t *nfsx)
3604df
                 mnt3_auth_params_deinit (mstate->auth_params);
3604df
 
3604df
         /* Unmount everything and clear mountdict */
3604df
-        mnt3svc_umountall (mstate);
3604df
+        LOCK (&mstate->mountlock);
3604df
+        {
3604df
+                __mnt3svc_umountall (mstate);
3604df
+                dict_unref (mstate->mountdict);
3604df
+        }
3604df
+        UNLOCK (&mstate->mountlock);
3604df
+
3604df
 }
3604df
 
3604df
 rpcsvc_program_t *
3604df
-- 
3604df
2.9.3
3604df