]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-linux-avoid-signal-wakeups-while-sleeping-20020129
authorNickolai Zeldovich <kolya@mit.edu>
Tue, 29 Jan 2002 19:45:39 +0000 (19:45 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 29 Jan 2002 19:45:39 +0000 (19:45 +0000)
Block all signals while sleeping; this prevents 100% cpu usage
when a process waiting for an afs operation to complete receives
a signal.

(cherry picked from commit 41fb11e6b23ba320f7fff442b2b6c3b01c339ad0)

src/afs/LINUX/osi_sleep.c

index 1ddad85ba1655cf6775c64d9867581502d5714cc..b5b5e96ce55276f69974ccc33822b18852148f16 100644 (file)
@@ -223,9 +223,22 @@ void afs_osi_Sleep(char *event)
     seq = evp->seq;
 
     while (seq == evp->seq) {
+       sigset_t saved_set;
+
        AFS_ASSERT_GLOCK();
        AFS_GUNLOCK();
+       spin_lock_irq(&current->sigmask_lock);
+       saved_set = current->blocked;
+       sigfillset(&current->blocked);
+       recalc_sigpending(current);
+       spin_unlock_irq(&current->sigmask_lock);
+
        interruptible_sleep_on(&evp->cond);
+
+       spin_lock_irq(&current->sigmask_lock);
+       current->blocked = saved_set;
+       recalc_sigpending(current);
+       spin_unlock_irq(&current->sigmask_lock);
        AFS_GLOCK();
     }
     relevent(evp);