Fix usage of RX_CALL_TQ_WAIT flag

The usage of RX_CALL_TQ_WAIT flag was not consistent within both
rx.c and rx_rdwr.c.  When a thread is waiting on the transmit
queue it must not only set the RX_CALL_TQ_WAIT flag but also
increment the call->tqWaiters count.  Upon waking up, it must
decrement call->tqWaiters and only clear RX_CALL_TQ_WAIT if
the tqWaiters count reaches zero.

Change-Id: I7de01d27f073cddd9651fbcd9cd2038e56ac35cf
Reviewed-on: http://gerrit.openafs.org/1685
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Jeffrey Altman 2010-04-01 23:33:16 -04:00 committed by Derrick Brashear
parent 00a0351ae0
commit f61d2ba1c9
2 changed files with 16 additions and 0 deletions

View File

@ -4732,11 +4732,15 @@ rxi_ResetCall(struct rx_call *call, int newcall)
if (flags & RX_CALL_TQ_BUSY) {
call->flags = RX_CALL_TQ_CLEARME | RX_CALL_TQ_BUSY;
call->flags |= (flags & RX_CALL_TQ_WAIT);
call->tqWaiters++;
#ifdef RX_ENABLE_LOCKS
CV_WAIT(&call->cv_tq, &call->lock);
#else /* RX_ENABLE_LOCKS */
osi_rxSleep(&call->tq);
#endif /* RX_ENABLE_LOCKS */
call->tqWaiters--;
if (call->tqWaiters == 0)
call->flags &= ~RX_CALL_TQ_WAIT;
} else
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
{

View File

@ -716,11 +716,15 @@ rxi_WriteProc(struct rx_call *call, char *buf,
*/
while (call->flags & RX_CALL_TQ_BUSY) {
call->flags |= RX_CALL_TQ_WAIT;
call->tqWaiters++;
#ifdef RX_ENABLE_LOCKS
CV_WAIT(&call->cv_tq, &call->lock);
#else /* RX_ENABLE_LOCKS */
osi_rxSleep(&call->tq);
#endif /* RX_ENABLE_LOCKS */
call->tqWaiters--;
if (call->tqWaiters == 0)
call->flags &= ~RX_CALL_TQ_WAIT;
}
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
clock_NewTime(); /* Bogus: need new time package */
@ -1096,11 +1100,15 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
* packets to the transmit queue. */
while (!call->error && call->flags & RX_CALL_TQ_BUSY) {
call->flags |= RX_CALL_TQ_WAIT;
call->tqWaiters++;
#ifdef RX_ENABLE_LOCKS
CV_WAIT(&call->cv_tq, &call->lock);
#else /* RX_ENABLE_LOCKS */
osi_rxSleep(&call->tq);
#endif /* RX_ENABLE_LOCKS */
call->tqWaiters--;
if (call->tqWaiters == 0)
call->flags &= ~RX_CALL_TQ_WAIT;
}
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
/* cp is no longer valid since we may have given up the lock */
@ -1305,11 +1313,15 @@ rxi_FlushWrite(struct rx_call *call)
*/
while (call->flags & RX_CALL_TQ_BUSY) {
call->flags |= RX_CALL_TQ_WAIT;
call->tqWaiters++;
#ifdef RX_ENABLE_LOCKS
CV_WAIT(&call->cv_tq, &call->lock);
#else /* RX_ENABLE_LOCKS */
osi_rxSleep(&call->tq);
#endif /* RX_ENABLE_LOCKS */
call->tqWaiters--;
if (call->tqWaiters == 0)
call->flags &= ~RX_CALL_TQ_WAIT;
}
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */