summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-threads/src/io-threads.h
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-06-10 01:25:38 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-11 06:29:17 -0700
commit1c4d58fe57162a5247356dc95aa6204f26cbf4fe (patch)
treeec76072bc37f4d91baac23c0ec1aad7efb9dc1cc /xlators/performance/io-threads/src/io-threads.h
parentbd2b529fd3d1965ccfe8cc03f9223ed1e98f7e79 (diff)
io-threads: Fix missed notification in sem_timedwait
We're performing a calculation for skewing idle time that resulted in a timespec.tv_nsec value becoming larger than 1000 million or less than 0, forcing sem_timedwait to return with an EINVAL instead of waiting for a request notification from sem_post in iot_notify_worker(). This resulted in a missed notification that resulted in a hang followed by a timeout on the protocol/client side. This commit avoids the over- and under-flow in tv_nsec by skewing the tv_sec value instead. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/performance/io-threads/src/io-threads.h')
-rw-r--r--xlators/performance/io-threads/src/io-threads.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h
index ec17356942b..3e806aa78e9 100644
--- a/xlators/performance/io-threads/src/io-threads.h
+++ b/xlators/performance/io-threads/src/io-threads.h
@@ -58,8 +58,8 @@ typedef enum {
}iot_state_t;
#define iot_worker_active(wrk) ((wrk)->state == IOT_STATE_ACTIVE)
-#define MAX_IDLE_SKEW 1000 /* usecs */
-#define skew_usec_idle_time(usec) ((usec) + (random () % MAX_IDLE_SKEW))
+#define MAX_IDLE_SKEW 4 /* In secs */
+#define skew_sec_idle_time(sec) ((sec) + (random () % MAX_IDLE_SKEW))
#define IOT_DEFAULT_IDLE 180 /* In secs. */
#define IOT_MIN_THREADS 2