summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src
diff options
context:
space:
mode:
authorXie Changlong <xiechanglong@cmss.chinamobile.com>2019-08-09 14:19:07 +0800
committerAmar Tumballi <amarts@gmail.com>2019-08-22 04:54:11 +0000
commit8b9b8abd4878d3116dda1c7d7b9736cda09691b6 (patch)
tree8492f345f482a162d8be40309c9ab6c98cd24f1e /xlators/nfs/server/src
parent6edaf694e391d91f42a324da6d3a413d66ae74b9 (diff)
nlm: check if nlm4 is initialized in nlm_priv
Otherwise, gnfs will crash in following steps. 1) gluster v set <VOL> nfs.disable off 2) gluster v set <VOL> nfs.nlm off 3) kill -SIGUSR1 <GNFS_PID> 4) gnfs crash with SIGSEGV as follows: nlm_priv (this=this@entry=0x7f1ad00173b0) at nlm4.c:2742 0x00007f1acf89d29d in nfs_priv (this=0x7f1ad00173b0) at nfs.c:1662 0x00007f1ae2941085 in gf_proc_dump_single_xlator_info (trav=trav@entry=0x7f1ad00173b0) at statedump.c:502 0x00007f1ae29410b8 in gf_proc_dump_per_xlator_info (top=top@entry=0x7f1ad00173b0) at statedump.c:519 fixes: bz#1739360 Change-Id: Ib9b207a4ccb3226dbc2c449b77de348cbc9a3d3c Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
Diffstat (limited to 'xlators/nfs/server/src')
-rw-r--r--xlators/nfs/server/src/nlm4.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index c3c1453..957f424 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -57,6 +57,8 @@ gf_lock_t nlm_client_list_lk;
/* race on this is harmless */
int nlm_grace_period = 50;
+static gf_boolean_t nlm4_inited = _gf_false;
+
#define nlm4_validate_nfs3_state(request, state, status, label, retval) \
do { \
state = rpcsvc_request_program_private(request); \
@@ -2574,7 +2576,6 @@ nlm4svc_init(xlator_t *nfsx)
};
FILE *pidfile = NULL;
pid_t pid = -1;
- static gf_boolean_t nlm4_inited = _gf_false;
/* Already inited */
if (nlm4_inited)
@@ -2733,7 +2734,7 @@ nlm_priv(xlator_t *this)
gf_proc_dump_add_section("nfs.nlm");
- if (TRY_LOCK(&nlm_client_list_lk))
+ if ((nlm4_inited == _gf_false) || TRY_LOCK(&nlm_client_list_lk))
goto out;
list_for_each_entry(client, &nlm_client_list, nlm_clients)
@@ -2766,7 +2767,8 @@ out:
gf_proc_dump_build_key(key, "nlm", "statedump_error");
gf_proc_dump_write(key,
"Unable to dump nlm state because "
- "nlm_client_list_lk lock couldn't be acquired");
+ "nlm is not initialised or nlm_client_list_lk "
+ "lock couldn't be acquired");
}
return ret;