From daed52b8ebcac7ef36f11e944f83826f46593867 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 23 Jun 2017 10:01:27 +0200 Subject: nfs: make nfs3_call_state_t refcounted There is no refcounting done of the nfs3_call_state_t structure, which seems to result in use-after-free problems in the NLM part of Gluster/NFS. The structure is initialized with two different functions, it is easier to have a single place to do this. The Gluster/NFS part will not use the refcounting, for now. This is being added to make the NLM code more stable. nfs3_call_state_wipe() will behave as before for Gluster/NFS, but cleanup is triggered through the refcounting now. This prevents major changes to the stable part of the NFS-server, and makes it possible to improve the NLM component separately. Change-Id: I2e15bcf12af74e8a46c2727e4a160e9444d29ece BUG: 1467313 Signed-off-by: Niels de Vos Reviewed-on: https://review.gluster.org/17696 Smoke: Gluster Build System Reviewed-by: Amar Tumballi CentOS-regression: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: jiffin tony Thottan --- xlators/nfs/server/src/nfs3.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xlators/nfs/server/src/nfs3.h') diff --git a/xlators/nfs/server/src/nfs3.h b/xlators/nfs/server/src/nfs3.h index 4cb3e67528d..187fb7e1912 100644 --- a/xlators/nfs/server/src/nfs3.h +++ b/xlators/nfs/server/src/nfs3.h @@ -23,6 +23,7 @@ #include "nlm4.h" #include "acl3-xdr.h" #include "acl3.h" +#include "refcount.h" #include #define GF_NFS3 GF_NFS"-nfsv3" @@ -184,6 +185,8 @@ typedef int (*nfs3_resume_fn_t) (void *cs); * Imagine the chaos if we need a mem-pool for each one of those sub-structures. */ struct nfs3_local { + GF_REF_DECL; + rpcsvc_request_t *req; xlator_t *vol; nfs3_resume_fn_t resume_fn; -- cgit