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