From 6f8da199e5c694e0e9a90f4737a9a1618470389e Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 23 Oct 2012 13:35:43 +0100 Subject: [PATCH] rx: Don't use app-thread variable in SendXmitList The value of call->app.mode is changed by the application thread without taking the call lock. Instead of using this variable in SendXmitList to determine whether the queue should be flushed, add a new flag (RX_CALL_FLUSH) to control flushing behaviour. As call->flags is manipulated under the call lock, its value can be safely used by SendXmitList. Change-Id: I8416697f457e5003af08a35ac08809512b03a9be Reviewed-on: http://gerrit.openafs.org/8286 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- src/rx/rx.c | 2 +- src/rx/rx.h | 2 +- src/rx/rx_rdwr.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 7ab0e46be..adc19c810 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -5964,7 +5964,7 @@ rxi_SendXmitList(struct rx_call *call, struct rx_packet **list, int len, * the listener or event threads */ if ((list[len - 1]->header.flags & RX_LAST_PACKET) - || call->app.mode == RX_MODE_RECEIVING || call->app.mode == RX_MODE_EOF + || (call->flags & RX_CALL_FLUSH) || (call->flags & RX_CALL_FAST_RECOVER)) { /* Check for the case where the current list contains * an acked packet. Since we always send retransmissions diff --git a/src/rx/rx.h b/src/rx/rx.h index e0e6152af..a7cf4d2fe 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -170,7 +170,7 @@ extern u_short rx_PortOf(struct rx_peer *peer); #define RX_CALL_PEER_BUSY 0x20000 /* the last packet we received on this call was a * BUSY packet; i.e. the channel for this call is busy */ #define RX_CALL_ACKALL_SENT 0x40000 /* ACKALL has been sent on the call */ - +#define RX_CALL_FLUSH 0x80000 /* Transmit queue should be flushed to peer */ #endif diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 03cef0ceb..98c0c857c 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -1271,6 +1271,8 @@ rxi_FlushWrite(struct rx_call *call) if (call->error) call->app.mode = RX_MODE_ERROR; + call->flags |= RX_CALL_FLUSH; + cp = call->app.currentPacket; if (cp) { -- 2.39.5