From 21bfb25d40035a7f0fbfc3af45fe0aa8a248e236 Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Mon, 23 Jan 2006 21:30:18 +0000 Subject: [PATCH] STABLE14-viced-grow-h_maxSlots-20060123 and jhutz@cs.cmu.edu The size of h_maxSlots as computed based upon the value of MAX_FILESERVER_THREAD is too small. It is possible for h_lwpIndex (in the pthread case) to have produce the same Slot value for multiple threads. In that case it is possible for the following to occur: X: h_Hold_r(host) X: H_UNLOCK ... E: H_LOCK E: Check h_Held_r(host); it is true, so don't hold E: H_UNLOCK X: H_LOCK X: h_Release_r(host) X: h_TossStuff_r(host) [called by h_Release_r] X: H_UNLOCK E: CheckHost(host) The end result would be a crash due to a reference to a null field in the host processed by CheckHost. This patch is a bit of a hack in that it solves the problem by increasing the number of slots for threads and does not determine the correct number of threads the process should be allowed to produce. (cherry picked from commit 4a5dda84178842e3eaa61d03fecc96149333dd13) --- src/viced/host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viced/host.h b/src/viced/host.h index a095d729f..43c5122d8 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -41,7 +41,7 @@ extern pthread_mutex_t host_glock_mutex; #define h_threadsMask 31 /* for remainder */ /* size of the hold array for each host */ -#define h_maxSlots ((MAX_FILESERVER_THREAD+h_threadsPerSlot-1)>>h_threadsShift) +#define h_maxSlots (((MAX_FILESERVER_THREAD+h_threadsPerSlot-1)>>h_threadsShift)+1) struct Identity { char valid; /* zero if UUID is unknown */ -- 2.39.5