new upstream release

upgraded to db-4.7.25
This commit is contained in:
Jan Šafránek 2009-02-17 11:20:45 +00:00
parent 3301d7410a
commit ac27aa70d7
7 changed files with 426 additions and 170 deletions

View File

@ -1,24 +1,14 @@
Don't read the user's configuration file if we're running in a setuid Don't read the user's configuration file if we're running in a setuid
or setgid application. or setgid application.
diff -up openldap-2.4.11/libraries/libldap/init.c.patch3 openldap-2.4.11/libraries/libldap/init.c diff -up openldap-2.4.14/libraries/libldap/init.c.setugid openldap-2.4.14/libraries/libldap/init.c
--- openldap-2.4.11/libraries/libldap/init.c.patch3 2008-09-01 09:57:09.000000000 +0200 --- openldap-2.4.14/libraries/libldap/init.c.setugid 2009-02-17 08:31:19.000000000 +0100
+++ openldap-2.4.11/libraries/libldap/init.c 2008-09-01 09:57:09.000000000 +0200 +++ openldap-2.4.14/libraries/libldap/init.c 2009-02-17 08:39:01.000000000 +0100
@@ -609,10 +609,11 @@ void ldap_int_initialize( struct ldapopt @@ -634,7 +634,7 @@ void ldap_int_initialize( struct ldapopt
if( user != NULL ) { openldap_ldap_init_w_sysconf(LDAP_CONF_FILE);
gopts->ldo_def_sasl_authcid = LDAP_STRDUP( user );
} #ifdef HAVE_GETEUID
- } - if ( geteuid() != getuid() )
+ } + if ( geteuid() != getuid() || getegid() == getgid() )
return;
#endif #endif
openldap_ldap_init_w_sysconf(LDAP_CONF_FILE);
+ if( ( getuid() == geteuid() ) && ( getgid() == getegid() ) ) {
openldap_ldap_init_w_userconf(LDAP_USERRC_FILE);
{
@@ -642,4 +643,5 @@ void ldap_int_initialize( struct ldapopt
}
openldap_ldap_init_w_env(gopts, NULL);
+ }
}

View File

@ -1,9 +1,9 @@
diff -up openldap-2.4.11/include/ldap.h.patch10 openldap-2.4.11/include/ldap.h diff -up evo-openldap-2.4.14/include/ldap.h.evolution-ntlm evo-openldap-2.4.14/include/ldap.h
--- openldap-2.4.11/include/ldap.h.patch10 2008-07-09 02:29:57.000000000 +0200 --- evo-openldap-2.4.14/include/ldap.h.evolution-ntlm 2009-01-27 00:29:53.000000000 +0100
+++ openldap-2.4.11/include/ldap.h 2008-09-01 10:17:27.000000000 +0200 +++ evo-openldap-2.4.14/include/ldap.h 2009-02-17 10:10:00.000000000 +0100
@@ -2359,5 +2359,26 @@ ldap_create_assertion_control LDAP_P(( @@ -2461,5 +2461,26 @@ ldap_parse_deref_control LDAP_P((
int iscritical, LDAPControl **ctrls,
LDAPControl **ctrlp )); LDAPDerefRes **drp ));
+/* +/*
+ * hacks for NTLM + * hacks for NTLM
@ -28,30 +28,30 @@ diff -up openldap-2.4.11/include/ldap.h.patch10 openldap-2.4.11/include/ldap.h
+ +
LDAP_END_DECL LDAP_END_DECL
#endif /* _LDAP_H */ #endif /* _LDAP_H */
diff -up openldap-2.4.11/libraries/libldap/Makefile.in.patch10 openldap-2.4.11/libraries/libldap/Makefile.in diff -up evo-openldap-2.4.14/libraries/libldap/Makefile.in.evolution-ntlm evo-openldap-2.4.14/libraries/libldap/Makefile.in
--- openldap-2.4.11/libraries/libldap/Makefile.in.patch10 2008-07-09 02:29:57.000000000 +0200 --- evo-openldap-2.4.14/libraries/libldap/Makefile.in.evolution-ntlm 2009-01-27 00:29:53.000000000 +0100
+++ openldap-2.4.11/libraries/libldap/Makefile.in 2008-09-01 10:17:27.000000000 +0200 +++ evo-openldap-2.4.14/libraries/libldap/Makefile.in 2009-02-17 10:10:00.000000000 +0100
@@ -20,7 +20,7 @@ PROGRAMS = apitest dntest ftest ltest ur @@ -20,7 +20,7 @@ PROGRAMS = apitest dntest ftest ltest ur
SRCS = bind.c open.c result.c error.c compare.c search.c \ SRCS = bind.c open.c result.c error.c compare.c search.c \
controls.c messages.c references.c extended.c cyrus.c \ controls.c messages.c references.c extended.c cyrus.c \
modify.c add.c modrdn.c delete.c abandon.c \ modify.c add.c modrdn.c delete.c abandon.c \
- sasl.c sbind.c unbind.c cancel.c \ - sasl.c gssapi.c sbind.c unbind.c cancel.c \
+ sasl.c ntlm.c sbind.c unbind.c cancel.c \ + sasl.c ntlm.c gssapi.c sbind.c unbind.c cancel.c \
filter.c free.c sort.c passwd.c whoami.c \ filter.c free.c sort.c passwd.c whoami.c \
getdn.c getentry.c getattr.c getvalues.c addentry.c \ getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c os-ip.c url.c pagectrl.c sortctrl.c vlvctrl.c \ request.c os-ip.c url.c pagectrl.c sortctrl.c vlvctrl.c \
@@ -32,7 +32,7 @@ SRCS = bind.c open.c result.c error.c co @@ -33,7 +33,7 @@ SRCS = bind.c open.c result.c error.c co
OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \ OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
controls.lo messages.lo references.lo extended.lo cyrus.lo \ controls.lo messages.lo references.lo extended.lo cyrus.lo \
modify.lo add.lo modrdn.lo delete.lo abandon.lo \ modify.lo add.lo modrdn.lo delete.lo abandon.lo \
- sasl.lo sbind.lo unbind.lo cancel.lo \ - sasl.lo gssapi.lo sbind.lo unbind.lo cancel.lo \
+ sasl.lo ntlm.lo sbind.lo unbind.lo cancel.lo \ + sasl.lo ntlm.lo gssapi.lo sbind.lo unbind.lo cancel.lo \
filter.lo free.lo sort.lo passwd.lo whoami.lo \ filter.lo free.lo sort.lo passwd.lo whoami.lo \
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \ getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
request.lo os-ip.lo url.lo pagectrl.lo sortctrl.lo vlvctrl.lo \ request.lo os-ip.lo url.lo pagectrl.lo sortctrl.lo vlvctrl.lo \
diff -up /dev/null openldap-2.4.11/libraries/libldap/ntlm.c diff -up /dev/null evo-openldap-2.4.14/libraries/libldap/ntlm.c
--- /dev/null 2008-09-01 10:45:28.589004265 +0200 --- /dev/null 2009-02-17 09:19:52.829004420 +0100
+++ openldap-2.4.11/libraries/libldap/ntlm.c 2008-09-01 10:17:27.000000000 +0200 +++ evo-openldap-2.4.14/libraries/libldap/ntlm.c 2009-02-17 10:10:00.000000000 +0100
@@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
+/* $OpenLDAP: pkg/ldap/libraries/libldap/ntlm.c,v 1.1.4.10 2002/01/04 20:38:21 kurt Exp $ */ +/* $OpenLDAP: pkg/ldap/libraries/libldap/ntlm.c,v 1.1.4.10 2002/01/04 20:38:21 kurt Exp $ */
+/* +/*

View File

@ -1,9 +1,9 @@
# We distribute own version of Berkeley DB to prevent # We distribute own version of Berkeley DB to prevent
# problems on db4.rpm upgrade - some versions of db4 do # problems on db4.rpm upgrade - some versions of db4 do
# not work with some versions of OpenLDAP. # not work with some versions of OpenLDAP.
%define db_version 4.6.21 %define db_version 4.7.25
%define ldbm_backend berkeley %define ldbm_backend berkeley
%define version 2.4.12 %define version 2.4.14
%define evolution_connector_prefix %{_libdir}/evolution-openldap %define evolution_connector_prefix %{_libdir}/evolution-openldap
%define evolution_connector_includedir %{evolution_connector_prefix}/include %define evolution_connector_includedir %{evolution_connector_prefix}/include
%define evolution_connector_libdir %{evolution_connector_prefix}/%{_lib} %define evolution_connector_libdir %{evolution_connector_prefix}/%{_lib}
@ -11,7 +11,7 @@
Summary: LDAP support libraries Summary: LDAP support libraries
Name: openldap Name: openldap
Version: %{version} Version: %{version}
Release: 3%{?dist} Release: 1%{?dist}
License: OpenLDAP License: OpenLDAP
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz
@ -39,8 +39,9 @@ Patch10: openldap-2.4.6-multilib.patch
Patch200: openldap-2.4.6-evolution-ntlm.patch Patch200: openldap-2.4.6-evolution-ntlm.patch
# Patches for db4 library # Patches for db4 library
Patch400: patch.4.6.21.1 Patch400: patch.4.7.25.1
Patch401: patch.4.6.21.2 Patch401: patch.4.7.25.2
Patch402: patch.4.7.25.3
URL: http://www.openldap.org/ URL: http://www.openldap.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRoot: %{_tmppath}/%{name}-%{version}-root
@ -125,6 +126,7 @@ programs needed for accessing and modifying OpenLDAP directories.
pushd db-%{db_version} pushd db-%{db_version}
%patch400 -p0 -b .patch1 %patch400 -p0 -b .patch1
%patch401 -p0 -b .patch2 %patch401 -p0 -b .patch2
%patch402 -p0 -b .patch3
popd popd
pushd openldap-%{version} pushd openldap-%{version}
@ -600,13 +602,17 @@ fi
%attr(0644,root,root) %{evolution_connector_libdir}/*.a %attr(0644,root,root) %{evolution_connector_libdir}/*.a
%changelog %changelog
* Sat Jan 17 2009 Tomas Mraz <tmraz@redhat.com> 2.4.11-3 * Tue Feb 17 2009 Jan Safranek <jsafranek@redhat.com> 2.4.14-1
- new upstream release
- upgraded to db-4.7.25
* Sat Jan 17 2009 Tomas Mraz <tmraz@redhat.com> 2.4.12-3
- rebuild with new openssl - rebuild with new openssl
* Mon Dec 15 2008 Caolán McNamara <caolanm@redhat.com> 2.4.11-2 * Mon Dec 15 2008 Caolán McNamara <caolanm@redhat.com> 2.4.12-2
- rebuild for libltdl, i.e. copy config.sub|guess from new location - rebuild for libltdl, i.e. copy config.sub|guess from new location
* Wed Oct 15 2008 Jan Safranek <jsafranek@redhat.com> 2.4.11-1 * Wed Oct 15 2008 Jan Safranek <jsafranek@redhat.com> 2.4.12-1
- new upstream release - new upstream release
* Mon Oct 13 2008 Jan Safranek <jsafranek@redhat.com> 2.4.11-3 * Mon Oct 13 2008 Jan Safranek <jsafranek@redhat.com> 2.4.11-3

View File

@ -1,94 +0,0 @@
Official usptream patch #1
Source: http://www.oracle.com/technology/products/berkeley-db/db/update/4.6.21/patch.4.6.21.html
*** dbinc/mp.h 2007-09-28 01:28:25.000000000 +1000
--- dbinc/mp.h 2008-02-14 01:22:09.000000000 +1100
***************
*** 639,644 ****
--- 639,647 ----
*/
#define MP_TRUNC_RECOVER 0x01
+ /* Private flags to DB_MPOOLFILE->close. */
+ #define DB_MPOOL_NOLOCK 0x002 /* Already have mpf locked. */
+
#if defined(__cplusplus)
}
#endif
*** mp/mp_fopen.c 2007-05-18 03:18:01.000000000 +1000
--- mp/mp_fopen.c 2008-02-12 16:09:42.000000000 +1100
***************
*** 888,894 ****
* when we try to flush them.
*/
deleted = 0;
! MUTEX_LOCK(dbenv, mfp->mutex);
if (F_ISSET(dbmfp, MP_MULTIVERSION))
--mfp->multiversion;
if (--mfp->mpf_cnt == 0 || LF_ISSET(DB_MPOOL_DISCARD)) {
--- 888,895 ----
* when we try to flush them.
*/
deleted = 0;
! if (!LF_ISSET(DB_MPOOL_NOLOCK))
! MUTEX_LOCK(dbenv, mfp->mutex);
if (F_ISSET(dbmfp, MP_MULTIVERSION))
--mfp->multiversion;
if (--mfp->mpf_cnt == 0 || LF_ISSET(DB_MPOOL_DISCARD)) {
***************
*** 909,921 ****
}
}
if (mfp->block_cnt == 0) {
if ((t_ret =
__memp_mf_discard(dbmp, mfp)) != 0 && ret == 0)
ret = t_ret;
deleted = 1;
}
}
! if (!deleted)
MUTEX_UNLOCK(dbenv, mfp->mutex);
done: /* Discard the DB_MPOOLFILE structure. */
--- 910,928 ----
}
}
if (mfp->block_cnt == 0) {
+ /*
+ * We should never discard this mp file if our caller
+ * is holding the lock on it. See comment in
+ * __memp_sync_file.
+ */
+ DB_ASSERT(dbenv, !LF_ISSET(DB_MPOOL_NOLOCK));
if ((t_ret =
__memp_mf_discard(dbmp, mfp)) != 0 && ret == 0)
ret = t_ret;
deleted = 1;
}
}
! if (!deleted && !LF_ISSET(DB_MPOOL_NOLOCK))
MUTEX_UNLOCK(dbenv, mfp->mutex);
done: /* Discard the DB_MPOOLFILE structure. */
*** mp/mp_sync.c 2007-06-02 04:32:44.000000000 +1000
--- mp/mp_sync.c 2008-02-12 16:09:42.000000000 +1100
***************
*** 755,761 ****
* This is important since we are called with the hash bucket
* locked. The mfp will get freed via the cleanup pass.
*/
! if (dbmfp != NULL && (t_ret = __memp_fclose(dbmfp, 0)) != 0 && ret == 0)
ret = t_ret;
--mfp->mpf_cnt;
--- 755,762 ----
* This is important since we are called with the hash bucket
* locked. The mfp will get freed via the cleanup pass.
*/
! if (dbmfp != NULL &&
! (t_ret = __memp_fclose(dbmfp, DB_MPOOL_NOLOCK)) != 0 && ret == 0)
ret = t_ret;
--mfp->mpf_cnt;

View File

@ -1,31 +0,0 @@
Official usptream patch #2
Source: http://www.oracle.com/technology/products/berkeley-db/db/update/4.6.21/patch.4.6.21.html
*** mp/mp_region.c 2007-05-18 03:18:01.000000000 +1000
--- mp/mp_region.c 2008-06-24 13:15:56.000000000 +1000
***************
*** 249,256 ****
mtx_base = htab[0].mtx_hash;
}
if (mtx_base != MUTEX_INVALID)
! mtx_base += reginfo_off * htab_buckets;
/* Allocate hash table space and initialize it. */
if ((ret = __env_alloc(infop,
--- 249,262 ----
mtx_base = htab[0].mtx_hash;
}
+ /*
+ * We preallocated all of the mutexes in a block, so for regions after
+ * the first, we skip mutexes in use in earlier regions. Each region
+ * has the same number of buckets and there are two mutexes per hash
+ * bucket (the bucket mutex and the I/O mutex).
+ */
if (mtx_base != MUTEX_INVALID)
! mtx_base += reginfo_off * htab_buckets * 2;
/* Allocate hash table space and initialize it. */
if ((ret = __env_alloc(infop,

71
patch.4.7.25.2 Normal file
View File

@ -0,0 +1,71 @@
Index: lock/lock.c
===================================================================
RCS file: /a/CVSROOT/db/lock/lock.c,v
retrieving revision 12.61
diff -c -r12.61 lock.c
*** lock/lock.c 22 Jul 2008 12:08:53 -0000 12.61
--- lock/lock.c 19 Aug 2008 17:28:24 -0000
***************
*** 1278,1287 ****
SH_TAILQ_REMOVE(
&lt->obj_tab[obj_ndx], sh_obj, links, __db_lockobj);
if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) {
! LOCK_REGION_LOCK(env);
__env_alloc_free(&lt->reginfo,
SH_DBT_PTR(&sh_obj->lockobj));
! LOCK_REGION_UNLOCK(env);
}
SH_TAILQ_INSERT_HEAD(
&FREE_OBJS(lt, part_id), sh_obj, links, __db_lockobj);
--- 1278,1289 ----
SH_TAILQ_REMOVE(
&lt->obj_tab[obj_ndx], sh_obj, links, __db_lockobj);
if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) {
! if (region->part_t_size != 1)
! LOCK_REGION_LOCK(env);
__env_alloc_free(&lt->reginfo,
SH_DBT_PTR(&sh_obj->lockobj));
! if (region->part_t_size != 1)
! LOCK_REGION_UNLOCK(env);
}
SH_TAILQ_INSERT_HEAD(
&FREE_OBJS(lt, part_id), sh_obj, links, __db_lockobj);
***************
*** 1470,1484 ****
if (obj->size <= sizeof(sh_obj->objdata))
p = sh_obj->objdata;
else {
! LOCK_REGION_LOCK(env);
if ((ret =
__env_alloc(&lt->reginfo, obj->size, &p)) != 0) {
__db_errx(env,
"No space for lock object storage");
! LOCK_REGION_UNLOCK(env);
goto err;
}
! LOCK_REGION_UNLOCK(env);
}
memcpy(p, obj->data, obj->size);
--- 1472,1492 ----
if (obj->size <= sizeof(sh_obj->objdata))
p = sh_obj->objdata;
else {
! /*
! * If we have only one partition, the region is locked.
! */
! if (region->part_t_size != 1)
! LOCK_REGION_LOCK(env);
if ((ret =
__env_alloc(&lt->reginfo, obj->size, &p)) != 0) {
__db_errx(env,
"No space for lock object storage");
! if (region->part_t_size != 1)
! LOCK_REGION_UNLOCK(env);
goto err;
}
! if (region->part_t_size != 1)
! LOCK_REGION_UNLOCK(env);
}
memcpy(p, obj->data, obj->size);

314
patch.4.7.25.3 Normal file
View File

@ -0,0 +1,314 @@
*** lock/lock_deadlock.c 2008-03-11 00:31:33.000000000 +1100
--- lock/lock_deadlock.c 2008-12-16 21:54:18.000000000 +1100
***************
*** 121,127 ****
DB_LOCKTAB *lt;
db_timespec now;
locker_info *idmap;
! u_int32_t *bitmap, *copymap, **deadp, **free_me, *tmpmap;
u_int32_t i, cid, keeper, killid, limit, nalloc, nlockers;
u_int32_t lock_max, txn_max;
int ret, status;
--- 121,127 ----
DB_LOCKTAB *lt;
db_timespec now;
locker_info *idmap;
! u_int32_t *bitmap, *copymap, **deadp, **deadlist, *tmpmap;
u_int32_t i, cid, keeper, killid, limit, nalloc, nlockers;
u_int32_t lock_max, txn_max;
int ret, status;
***************
*** 133,139 ****
if (IS_REP_CLIENT(env))
atype = DB_LOCK_MINWRITE;
! free_me = NULL;
lt = env->lk_handle;
if (rejectp != NULL)
--- 133,140 ----
if (IS_REP_CLIENT(env))
atype = DB_LOCK_MINWRITE;
! copymap = tmpmap = NULL;
! deadlist = NULL;
lt = env->lk_handle;
if (rejectp != NULL)
***************
*** 179,189 ****
memcpy(copymap, bitmap, nlockers * sizeof(u_int32_t) * nalloc);
if ((ret = __os_calloc(env, sizeof(u_int32_t), nalloc, &tmpmap)) != 0)
! goto err1;
/* Find a deadlock. */
if ((ret =
! __dd_find(env, bitmap, idmap, nlockers, nalloc, &deadp)) != 0)
return (ret);
/*
--- 180,190 ----
memcpy(copymap, bitmap, nlockers * sizeof(u_int32_t) * nalloc);
if ((ret = __os_calloc(env, sizeof(u_int32_t), nalloc, &tmpmap)) != 0)
! goto err;
/* Find a deadlock. */
if ((ret =
! __dd_find(env, bitmap, idmap, nlockers, nalloc, &deadlist)) != 0)
return (ret);
/*
***************
*** 204,211 ****
txn_max = TXN_MAXIMUM;
killid = BAD_KILLID;
! free_me = deadp;
! for (; *deadp != NULL; deadp++) {
if (rejectp != NULL)
++*rejectp;
killid = (u_int32_t)(*deadp - bitmap) / nalloc;
--- 205,211 ----
txn_max = TXN_MAXIMUM;
killid = BAD_KILLID;
! for (deadp = deadlist; *deadp != NULL; deadp++) {
if (rejectp != NULL)
++*rejectp;
killid = (u_int32_t)(*deadp - bitmap) / nalloc;
***************
*** 342,352 ****
__db_msg(env,
"Aborting locker %lx", (u_long)idmap[killid].id);
}
! __os_free(env, tmpmap);
! err1: __os_free(env, copymap);
!
! err: if (free_me != NULL)
! __os_free(env, free_me);
__os_free(env, bitmap);
__os_free(env, idmap);
--- 342,353 ----
__db_msg(env,
"Aborting locker %lx", (u_long)idmap[killid].id);
}
! err: if(copymap != NULL)
! __os_free(env, copymap);
! if (deadlist != NULL)
! __os_free(env, deadlist);
! if(tmpmap != NULL)
! __os_free(env, tmpmap);
__os_free(env, bitmap);
__os_free(env, idmap);
***************
*** 360,365 ****
--- 361,377 ----
#define DD_INVALID_ID ((u_int32_t) -1)
+ /*
+ * __dd_build --
+ * Build the lock dependency bit maps.
+ * Notes on syncronization:
+ * LOCK_SYSTEM_LOCK is used to hold objects locked when we have
+ * a single partition.
+ * LOCK_LOCKERS is held while we are walking the lockers list and
+ * to single thread the use of lockerp->dd_id.
+ * LOCK_DD protects the DD list of objects.
+ */
+
static int
__dd_build(env, atype, bmp, nlockers, allocp, idmap, rejectp)
ENV *env;
***************
*** 393,398 ****
--- 405,411 ----
* In particular we do not build the conflict array and our caller
* needs to expect this.
*/
+ LOCK_SYSTEM_LOCK(lt, region);
if (atype == DB_LOCK_EXPIRE) {
skip: LOCK_DD(env, region);
op = SH_TAILQ_FIRST(&region->dd_objs, __db_lockobj);
***************
*** 430,446 ****
OBJECT_UNLOCK(lt, region, indx);
}
UNLOCK_DD(env, region);
goto done;
}
/*
! * We'll check how many lockers there are, add a few more in for
! * good measure and then allocate all the structures. Then we'll
! * verify that we have enough room when we go back in and get the
! * mutex the second time.
*/
! retry: count = region->stat.st_nlockers;
if (count == 0) {
*nlockers = 0;
return (0);
}
--- 443,460 ----
OBJECT_UNLOCK(lt, region, indx);
}
UNLOCK_DD(env, region);
+ LOCK_SYSTEM_UNLOCK(lt, region);
goto done;
}
/*
! * Allocate after locking the region
! * to make sure the structures are large enough.
*/
! LOCK_LOCKERS(env, region);
! count = region->stat.st_nlockers;
if (count == 0) {
+ UNLOCK_LOCKERS(env, region);
*nlockers = 0;
return (0);
}
***************
*** 448,497 ****
if (FLD_ISSET(env->dbenv->verbose, DB_VERB_DEADLOCK))
__db_msg(env, "%lu lockers", (u_long)count);
- count += 20;
nentries = (u_int32_t)DB_ALIGN(count, 32) / 32;
! /*
! * Allocate enough space for a count by count bitmap matrix.
! *
! * XXX
! * We can probably save the malloc's between iterations just
! * reallocing if necessary because count grew by too much.
! */
if ((ret = __os_calloc(env, (size_t)count,
! sizeof(u_int32_t) * nentries, &bitmap)) != 0)
return (ret);
if ((ret = __os_calloc(env,
sizeof(u_int32_t), nentries, &tmpmap)) != 0) {
__os_free(env, bitmap);
return (ret);
}
if ((ret = __os_calloc(env,
(size_t)count, sizeof(locker_info), &id_array)) != 0) {
__os_free(env, bitmap);
__os_free(env, tmpmap);
return (ret);
}
/*
- * Now go back in and actually fill in the matrix.
- */
- if (region->stat.st_nlockers > count) {
- __os_free(env, bitmap);
- __os_free(env, tmpmap);
- __os_free(env, id_array);
- goto retry;
- }
-
- /*
* First we go through and assign each locker a deadlock detector id.
*/
id = 0;
- LOCK_LOCKERS(env, region);
SH_TAILQ_FOREACH(lip, &region->lockers, ulinks, __db_locker) {
if (lip->master_locker == INVALID_ROFF) {
lip->dd_id = id++;
id_array[lip->dd_id].id = lip->id;
switch (atype) {
--- 462,498 ----
if (FLD_ISSET(env->dbenv->verbose, DB_VERB_DEADLOCK))
__db_msg(env, "%lu lockers", (u_long)count);
nentries = (u_int32_t)DB_ALIGN(count, 32) / 32;
! /* Allocate enough space for a count by count bitmap matrix. */
if ((ret = __os_calloc(env, (size_t)count,
! sizeof(u_int32_t) * nentries, &bitmap)) != 0) {
! UNLOCK_LOCKERS(env, region);
return (ret);
+ }
if ((ret = __os_calloc(env,
sizeof(u_int32_t), nentries, &tmpmap)) != 0) {
+ UNLOCK_LOCKERS(env, region);
__os_free(env, bitmap);
return (ret);
}
if ((ret = __os_calloc(env,
(size_t)count, sizeof(locker_info), &id_array)) != 0) {
+ UNLOCK_LOCKERS(env, region);
__os_free(env, bitmap);
__os_free(env, tmpmap);
return (ret);
}
/*
* First we go through and assign each locker a deadlock detector id.
*/
id = 0;
SH_TAILQ_FOREACH(lip, &region->lockers, ulinks, __db_locker) {
if (lip->master_locker == INVALID_ROFF) {
+ DB_ASSERT(env, id < count);
lip->dd_id = id++;
id_array[lip->dd_id].id = lip->id;
switch (atype) {
***************
*** 510,516 ****
lip->dd_id = DD_INVALID_ID;
}
- UNLOCK_LOCKERS(env, region);
/*
* We only need consider objects that have waiters, so we use
--- 511,516 ----
***************
*** 669,675 ****
* status after building the bit maps so that we will not detect
* a blocked transaction without noting that it is already aborting.
*/
- LOCK_LOCKERS(env, region);
for (id = 0; id < count; id++) {
if (!id_array[id].valid)
continue;
--- 669,674 ----
***************
*** 738,743 ****
--- 737,743 ----
id_array[id].in_abort = 1;
}
UNLOCK_LOCKERS(env, region);
+ LOCK_SYSTEM_UNLOCK(lt, region);
/*
* Now we can release everything except the bitmap matrix that we
***************
*** 839,844 ****
--- 839,845 ----
ret = 0;
/* We must lock so this locker cannot go away while we abort it. */
+ LOCK_SYSTEM_LOCK(lt, region);
LOCK_LOCKERS(env, region);
/*
***************
*** 895,900 ****
--- 896,902 ----
done: OBJECT_UNLOCK(lt, region, info->last_ndx);
err:
out: UNLOCK_LOCKERS(env, region);
+ LOCK_SYSTEM_UNLOCK(lt, region);
return (ret);
}