21ab4e
From 316f8065d6a8db5a19247c6389e15e196bfeec12 Mon Sep 17 00:00:00 2001
21ab4e
From: Niels de Vos <ndevos@redhat.com>
21ab4e
Date: Fri, 13 Jan 2017 14:02:45 +0100
21ab4e
Subject: [PATCH 440/473] nfs/nlm: ignore notify when there is no matching rpc
21ab4e
 request
21ab4e
21ab4e
In certain (unclear) occasions it seems to happen that there are
21ab4e
notifications sent to the Gluster/NFS NLM service, but no call-state can
21ab4e
be found. Instead of segfaulting, log an error but keep on running.
21ab4e
21ab4e
Cherry picked from commit e997d752ba08f80b1b00d2c0035874befafe5200:
21ab4e
> Change-Id: I0f186e56e46a86ca40314d230c1cc7719c61f0b5
21ab4e
> BUG: 1381970
21ab4e
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
21ab4e
> Reviewed-on: https://review.gluster.org/17185
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: soumya k <skoduri@redhat.com>
21ab4e
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
21ab4e
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
21ab4e
21ab4e
Change-Id: I0f186e56e46a86ca40314d230c1cc7719c61f0b5
21ab4e
Signed-off-by: Niels de Vos <ndevos@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/106032
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/nfs/server/src/nlm4.c | 8 +++++++-
21ab4e
 1 file changed, 7 insertions(+), 1 deletion(-)
21ab4e
21ab4e
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
21ab4e
index 1675116..0e4a4d8 100644
21ab4e
--- a/xlators/nfs/server/src/nlm4.c
21ab4e
+++ b/xlators/nfs/server/src/nlm4.c
21ab4e
@@ -923,10 +923,16 @@ nlm_rpcclnt_notify (struct rpc_clnt *rpc_clnt, void *mydata,
21ab4e
         nfs3_call_state_t *cs          = NULL;
21ab4e
 
21ab4e
         cs = mydata;
21ab4e
-        caller_name = cs->args.nlm4_lockargs.alock.caller_name;
21ab4e
 
21ab4e
         switch (fn) {
21ab4e
         case RPC_CLNT_CONNECT:
21ab4e
+                if (!cs->req) {
21ab4e
+                        gf_msg (GF_NLM, GF_LOG_ERROR, EINVAL,
21ab4e
+                                NFS_MSG_RPC_CLNT_ERROR, "Spurious notify?!");
21ab4e
+                        goto err;
21ab4e
+                }
21ab4e
+
21ab4e
+                caller_name = cs->args.nlm4_lockargs.alock.caller_name;
21ab4e
                 ret = nlm_set_rpc_clnt (rpc_clnt, caller_name);
21ab4e
                 if (ret == -1) {
21ab4e
                         gf_msg (GF_NLM, GF_LOG_ERROR, 0,
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e