ITS#5129 fix alock_close with Quick mode

This commit is contained in:
Howard Chu 2007-09-08 05:26:03 +00:00
parent 6a6adff86c
commit 40e796c547
3 changed files with 10 additions and 6 deletions

View File

@ -516,7 +516,7 @@ alock_scan ( alock_info_t * info )
} }
int int
alock_close ( alock_info_t * info ) alock_close ( alock_info_t * info, int nosave )
{ {
alock_slot_t slot_data; alock_slot_t slot_data;
int res; int res;
@ -540,7 +540,9 @@ alock_close ( alock_info_t * info )
free (slot_data.al_appname); free (slot_data.al_appname);
return ALOCK_UNSTABLE; 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); res = alock_write_slot (info, &slot_data);
if (res == -1) { if (res == -1) {
close (info->al_fd); close (info->al_fd);

View File

@ -66,7 +66,7 @@ typedef struct alock_slot {
LDAP_SLAPD_F (int) alock_open LDAP_P(( alock_info_t * info, const char * appname, LDAP_SLAPD_F (int) alock_open LDAP_P(( alock_info_t * info, const char * appname,
const char * envdir, int locktype )); const char * envdir, int locktype ));
LDAP_SLAPD_F (int) alock_scan LDAP_P(( alock_info_t * info )); 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_SLAPD_F (int) alock_recover LDAP_P(( alock_info_t * info ));
LDAP_END_DECL LDAP_END_DECL

View File

@ -195,9 +195,11 @@ bdb_db_open( BackendDB *be, ConfigReply *cr )
be->be_suffix[0].bv_val, 0, 0 ); be->be_suffix[0].bv_val, 0, 0 );
if ( quick ) { if ( quick ) {
Debug( LDAP_DEBUG_ANY, 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 ); 0, 0, 0 );
return -1; slapMode ^= SLAP_TOOL_QUICK;
rc = -1;
goto fail;
} else { } else {
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"Performing database recovery to activate new settings.\n", "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 ) { if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"bdb_db_close: database \"%s\": alock_close failed\n", "bdb_db_close: database \"%s\": alock_close failed\n",