Browse Source

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.
Noriko Hosoi 14 years ago
parent
commit
b554264e6b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      ldap/servers/slapd/back-ldbm/misc.c

+ 6 - 1
ldap/servers/slapd/back-ldbm/misc.c

@@ -199,9 +199,14 @@ int instance_set_busy_and_readonly(ldbm_instance *inst)
     } else {
     } else {
         inst->inst_flags &= ~INST_FLAG_READONLY;
         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);
     slapi_mtn_be_set_readonly(inst->inst_be, 1);
 
 
-    PR_Unlock(inst->inst_config_mutex);
     return 0;
     return 0;
 }
 }