From e1536926b7e2de7745f2d0a1931a0e4d42e34a24 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 20 Aug 2002 03:10:08 +0000 Subject: [PATCH] Quick check of LOCK_ID() return. Likely should retry... but not forever. --- servers/slapd/back-bdb/attribute.c | 9 +++++++-- servers/slapd/back-bdb/bind.c | 11 +++++++++-- servers/slapd/back-bdb/compare.c | 11 +++++++++-- servers/slapd/back-bdb/group.c | 7 ++++++- servers/slapd/back-bdb/referral.c | 9 +++++++-- servers/slapd/back-bdb/search.c | 11 +++++++++-- 6 files changed, 47 insertions(+), 11 deletions(-) diff --git a/servers/slapd/back-bdb/attribute.c b/servers/slapd/back-bdb/attribute.c index 00a16b0ee0..6ad4b30e78 100644 --- a/servers/slapd/back-bdb/attribute.c +++ b/servers/slapd/back-bdb/attribute.c @@ -70,8 +70,13 @@ bdb_attribute( if ( txn != NULL ) { locker = TXN_ID ( txn ); } else { - /* XXYYZ: need to check return value */ - LOCK_ID ( bdb->bi_dbenv, &locker ); + rc = LOCK_ID ( bdb->bi_dbenv, &locker ); + switch(rc) { + case 0: + break; + default: + return LDAP_OTHER; + } } if (target != NULL && dn_match(&target->e_nname, entry_ndn)) { diff --git a/servers/slapd/back-bdb/bind.c b/servers/slapd/back-bdb/bind.c index b9c44d0e94..7a9230dcdc 100644 --- a/servers/slapd/back-bdb/bind.c +++ b/servers/slapd/back-bdb/bind.c @@ -49,8 +49,15 @@ bdb_bind( Debug( LDAP_DEBUG_ARGS, "==> bdb_bind: dn: %s\n", dn->bv_val, 0, 0); #endif - /* XXYYZ: need to check return value */ - LOCK_ID(bdb->bi_dbenv, &locker); + rc = LOCK_ID(bdb->bi_dbenv, &locker); + switch(rc) { + case 0: + break; + default: + send_ldap_result( conn, op, rc=LDAP_OTHER, + NULL, "internal error", NULL, NULL ); + return rc; + } dn2entry_retry: /* get entry */ diff --git a/servers/slapd/back-bdb/compare.c b/servers/slapd/back-bdb/compare.c index 5b73810ddc..c22c4311c7 100644 --- a/servers/slapd/back-bdb/compare.c +++ b/servers/slapd/back-bdb/compare.c @@ -34,8 +34,15 @@ bdb_compare( u_int32_t locker; DB_LOCK lock; - /* XXYYZ: need to check return value */ - LOCK_ID ( bdb->bi_dbenv, &locker ); + rc = LOCK_ID(bdb->bi_dbenv, &locker); + switch(rc) { + case 0: + break; + default: + send_ldap_result( conn, op, rc=LDAP_OTHER, + NULL, "internal error", NULL, NULL ); + return rc; + } dn2entry_retry: /* get entry */ diff --git a/servers/slapd/back-bdb/group.c b/servers/slapd/back-bdb/group.c index 1d75d60202..d4fb4de09e 100644 --- a/servers/slapd/back-bdb/group.c +++ b/servers/slapd/back-bdb/group.c @@ -82,8 +82,13 @@ bdb_group( if ( txn ) { locker = TXN_ID( txn ); } else { - /* XXYYZ: need to check return value */ LOCK_ID ( bdb->bi_dbenv, &locker ); + switch(rc) { + case 0: + break; + default: + return 1; + } } if (dn_match(&target->e_name, gr_ndn)) { diff --git a/servers/slapd/back-bdb/referral.c b/servers/slapd/back-bdb/referral.c index 279e7a04ee..1ecbf1dddc 100644 --- a/servers/slapd/back-bdb/referral.c +++ b/servers/slapd/back-bdb/referral.c @@ -39,8 +39,13 @@ bdb_referrals( return rc; } - /* XXYYZ: need to check return value */ - LOCK_ID ( bdb->bi_dbenv, &locker ); + rc = LOCK_ID(bdb->bi_dbenv, &locker); + switch(rc) { + case 0: + break; + default: + return LDAP_OTHER; + } dn2entry_retry: /* get entry */ diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index b596112556..a7b0736719 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -71,8 +71,15 @@ bdb_search( manageDSAit = get_manageDSAit( op ); - /* XXYYZ: need to check return value */ - LOCK_ID (bdb->bi_dbenv, &locker ); + rc = LOCK_ID (bdb->bi_dbenv, &locker ); + switch(rc) { + case 0: + break; + default: + send_ldap_result( conn, op, rc=LDAP_OTHER, + NULL, "internal error", NULL, NULL ); + return rc; + } if ( nbase->bv_len == 0 ) { /* DIT root special case */ -- 2.39.5