]> git.sur5r.net Git - openldap/commitdiff
ITS#5129 fix alock_close with Quick mode
authorHoward Chu <hyc@openldap.org>
Sat, 8 Sep 2007 05:26:03 +0000 (05:26 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 8 Sep 2007 05:26:03 +0000 (05:26 +0000)
servers/slapd/alock.c
servers/slapd/alock.h
servers/slapd/back-bdb/init.c

index c7bb16d56f3b41c9ccd4518e38381cc68f783bd7..d469d3b56fcd1dd18ad207f689536b54ba8c3e2c 100644 (file)
@@ -516,7 +516,7 @@ alock_scan ( alock_info_t * info )
 }
 
 int
-alock_close ( alock_info_t * info )
+alock_close ( alock_info_t * info, int nosave )
 {
        alock_slot_t slot_data;
        int res;
@@ -540,7 +540,9 @@ alock_close ( alock_info_t * info )
                        free (slot_data.al_appname);
                return ALOCK_UNSTABLE;
        }
-       slot_data.al_lock = ALOCK_UNLOCKED | (slot_data.al_lock & ALOCK_NOSAVE);
+       slot_data.al_lock = ALOCK_UNLOCKED;
+       if ( nosave )
+               slot_data.al_lock |= ALOCK_NOSAVE;
        res = alock_write_slot (info, &slot_data);
        if (res == -1) {
                close (info->al_fd);
index 0f78fffdd0ef1196475e5f96d7a467990eff5121..947bc2b308e62860ae945b61eb18ab9cc6f5aabc 100644 (file)
@@ -66,7 +66,7 @@ typedef struct alock_slot {
 LDAP_SLAPD_F (int) alock_open LDAP_P(( alock_info_t * info, const char * appname,
        const char * envdir, int locktype ));
 LDAP_SLAPD_F (int) alock_scan LDAP_P(( alock_info_t * info ));
-LDAP_SLAPD_F (int) alock_close LDAP_P(( alock_info_t * info ));
+LDAP_SLAPD_F (int) alock_close LDAP_P(( alock_info_t * info, int nosave ));
 LDAP_SLAPD_F (int) alock_recover LDAP_P(( alock_info_t * info ));
 
 LDAP_END_DECL
index 88dee474bd4c1ddd64f0858e4e54df74b5540d57..ff7957f2377e5ac974fbff73b27327ccb389fde0 100644 (file)
@@ -195,9 +195,11 @@ bdb_db_open( BackendDB *be, ConfigReply *cr )
                                                        be->be_suffix[0].bv_val, 0, 0 );
                                        if ( quick ) {
                                                Debug( LDAP_DEBUG_ANY,
-                                                       "Cannot use Quick mode, perform manual recovery first.\n",
+                                                       "Cannot use Quick mode; perform manual recovery first.\n",
                                                        0, 0, 0 );
-                                               return -1;
+                                               slapMode ^= SLAP_TOOL_QUICK;
+                                               rc = -1;
+                                               goto fail;
                                        } else {
                                                Debug( LDAP_DEBUG_ANY,
                                                        "Performing database recovery to activate new settings.\n",
@@ -614,7 +616,7 @@ bdb_db_close( BackendDB *be, ConfigReply *cr )
                }
        }
 
-       rc = alock_close( &bdb->bi_alock_info );
+       rc = alock_close( &bdb->bi_alock_info, slapMode & SLAP_TOOL_QUICK );
        if( rc != 0 ) {
                Debug( LDAP_DEBUG_ANY,
                        "bdb_db_close: database \"%s\": alock_close failed\n",