Sleep uninteruptibly, waking up early may result in a crash

This commit is contained in:
Brian Behlendorf 2009-01-22 09:58:48 -08:00
parent 511176398c
commit 3f4126739d
2 changed files with 14 additions and 13 deletions

View File

@ -309,7 +309,8 @@ splat_kmem_cache_size_test(struct file *file, void *arg,
NULL, &kcp, NULL, flags); NULL, &kcp, NULL, flags);
if (!cache) { if (!cache) {
splat_vprint(file, name, splat_vprint(file, name,
"Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME); "Unable to create '%s'\n",
SPLAT_KMEM_CACHE_NAME);
return -ENOMEM; return -ENOMEM;
} }

View File

@ -84,7 +84,7 @@ typedef struct rw_thr {
static inline void static inline void
splat_rwlock_sleep(signed long delay) splat_rwlock_sleep(signed long delay)
{ {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(delay); schedule_timeout(delay);
} }
@ -431,7 +431,7 @@ splat_rwlock_test2(struct file *file, void *arg)
while (splat_rwlock_lock_and_test(&rwv.rw_priv_lock, while (splat_rwlock_lock_and_test(&rwv.rw_priv_lock,
atomic_read(&rwv.rw_acquired) != 0 || atomic_read(&rwv.rw_acquired) != 0 ||
atomic_read(&rwv.rw_waiters) != 0)) { atomic_read(&rwv.rw_waiters) != 0)) {
splat_rwlock_sleep(1 * HZ); splat_rwlock_sleep(HZ);
} }
/* If any of the write threads ever acquired the lock /* If any of the write threads ever acquired the lock