2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

1833. [bug] Race condition in isc_mutex_lock_profile(). [RT #13660]

This commit is contained in:
Mark Andrews 2005-03-16 01:56:17 +00:00
parent 713ad87a7f
commit 5e5b467e8c
2 changed files with 16 additions and 14 deletions

View File

@ -1,3 +1,5 @@
1833. [bug] Race condition in isc_mutex_lock_profile(). [RT #13660]
1832. [bug] named fails to return BADKEY on unknown TSIG algorithm.
[RT #13620]

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mutex.c,v 1.8 2004/03/05 05:11:16 marka Exp $ */
/* $Id: mutex.c,v 1.9 2005/03/16 01:56:17 marka Exp $ */
#include <config.h>
@ -126,19 +126,6 @@ isc_mutex_lock_profile(isc_mutex_t *mp, const char *file, int line) {
isc_mutexlocker_t *locker = NULL;
int i;
for (i = 0; i < ISC_MUTEX_MAX_LOCKERS; i++) {
if (mp->stats->lockers[i].file == NULL) {
locker = &mp->stats->lockers[i];
locker->file = file;
locker->line = line;
break;
} else if (mp->stats->lockers[i].file == file &&
mp->stats->lockers[i].line == line) {
locker = &mp->stats->lockers[i];
break;
}
}
gettimeofday(&prelock_t, NULL);
if (pthread_mutex_lock(&mp->mutex) != 0)
@ -152,6 +139,19 @@ isc_mutex_lock_profile(isc_mutex_t *mp, const char *file, int line) {
mp->stats->count++;
timevaladd(&mp->stats->wait_total, &postlock_t);
for (i = 0; i < ISC_MUTEX_MAX_LOCKERS; i++) {
if (mp->stats->lockers[i].file == NULL) {
locker = &mp->stats->lockers[i];
locker->file = file;
locker->line = line;
break;
} else if (mp->stats->lockers[i].file == file &&
mp->stats->lockers[i].line == line) {
locker = &mp->stats->lockers[i];
break;
}
}
if (locker != NULL) {
locker->count++;
timevaladd(&locker->wait_total, &postlock_t);