From 08e8733e51ea4027a705391ede57bbec17f4137b Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Jul 01 2011 22:25:17 +0000 Subject: Bug 711679 - unresponsive LDAP service when deleting vlv on replica https://bugzilla.redhat.com/show_bug.cgi?id=711679 Description: Normal operation acquires rlock on be_lock, then locks inst_config_mutex. Function instance_set_busy_and_readonly used to lock them in the opposite order, which caused the server deadlock. This patch fixes it by releasing inst_config_mutex before acquiring wlock on be_lock in slapi_mtn_be_set_readonly. (cherry picked from commit b554264e6b6056414d17044991c3b5ec839d0981) (cherry picked from commit fc7ed8fb8432827b5c4022dbbc445f5e121f4d4a) --- diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c index c8b3b7f..9255ddb 100644 --- a/ldap/servers/slapd/back-ldbm/misc.c +++ b/ldap/servers/slapd/back-ldbm/misc.c @@ -199,9 +199,14 @@ int instance_set_busy_and_readonly(ldbm_instance *inst) } else { inst->inst_flags &= ~INST_FLAG_READONLY; } + /* + * Normally, acquire rlock on be_lock, then lock inst_config_mutex. + * instance_set_busy_and_readonly should release inst_config_mutex + * before acquiring wlock on be_lock in slapi_mtn_be_set_readonly. + */ + PR_Unlock(inst->inst_config_mutex); slapi_mtn_be_set_readonly(inst->inst_be, 1); - PR_Unlock(inst->inst_config_mutex); return 0; }