Index: include/nucleus/pipe.h =================================================================== --- include/nucleus/pipe.h (revision 3166) +++ include/nucleus/pipe.h (working copy) @@ -101,7 +101,6 @@ struct fasync_struct *asyncq; wait_queue_head_t readq; /* open/read/poll waiters */ wait_queue_head_t syncq; /* sync waiters */ - unsigned int nwait; size_t ionrd; } xnpipe_state_t; Index: ksrc/nucleus/pipe.c =================================================================== --- ksrc/nucleus/pipe.c (revision 3166) +++ ksrc/nucleus/pipe.c (working copy) @@ -97,8 +97,6 @@ __setbits(state->status, mask); } - state->nwait++; - xnlock_put_irqrestore(&nklock, s); } @@ -135,7 +133,7 @@ xnlock_get_irqsave(&nklock, s); - if (--state->nwait == 0) { + if (testbits(state->status, mask)) { __clrbits(state->status, mask); removeq(&xnpipe_sleepq, &state->slink); } @@ -635,7 +633,6 @@ file->private_data = state; init_waitqueue_head(&state->readq); init_waitqueue_head(&state->syncq); - state->nwait = 0; __clrbits(state->status, XNPIPE_USER_ALL_WAIT | XNPIPE_USER_ALL_READY | XNPIPE_USER_SIGIO); @@ -699,12 +696,9 @@ xnlock_get_irqsave(&nklock, s); - if (testbits(state->status, XNPIPE_USER_WREAD)) - xnpipe_dequeue_wait(state, XNPIPE_USER_WREAD); + if (testbits(state->status, XNPIPE_USER_WREAD|XNPIPE_USER_WSYNC)) + xnpipe_dequeue_wait(state, XNPIPE_USER_WREAD|XNPIPE_USER_WSYNC); - if (testbits(state->status, XNPIPE_USER_WSYNC)) - xnpipe_dequeue_wait(state, XNPIPE_USER_WSYNC); - if (testbits(state->status, XNPIPE_KERN_CONN)) { int minor = xnminor_from_state(state);