From 36575f909b5e655d78ee0eda691550cb153860c9 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 23 Feb 2018 18:26:24 -0500 Subject: [PATCH] rx: pass serial number to rxi_SendRawAbort The practice of stamping abort packets with the connection's next serial number was altered by a0ae8f514519b73ba7f7653bb78b9fc5b6e228f8. This change restores the prior behavior by passing a serial number as a parameter to rxi_SendRawAbort() so that the serial number can be obtained from the connection instead of hard coded as 1. Reviewed-on: https://gerrit.openafs.org/12931 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit cacf2b646759132dbf21e9c04fb3cfc6c2f8f1f3) Change-Id: I36925d4283ba0aaedc7bee0e878d0e18d9aa23a7 Reviewed-on: https://gerrit.openafs.org/13050 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk --- src/rx/rx.c | 9 +++++++-- src/rx/rx_packet.c | 5 +++-- src/rx/rx_prototypes.h | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index c7742fab1..698be10dc 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -3165,10 +3165,15 @@ static_inline int rxi_AbortIfServerBusy(osi_socket socket, struct rx_connection *conn, struct rx_packet *np) { + afs_uint32 serial; + if ((rx_BusyThreshold > 0) && (rx_atomic_read(&rx_nWaiting) > rx_BusyThreshold)) { + MUTEX_ENTER(&conn->conn_data_lock); + serial = ++conn->serial; + MUTEX_EXIT(&conn->conn_data_lock); rxi_SendRawAbort(socket, conn->peer->host, conn->peer->port, - rx_BusyError, np, 0); + serial, rx_BusyError, np, 0); if (rx_stats_active) rx_atomic_inc(&rx_stats.nBusies); return 1; @@ -3420,7 +3425,7 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, don't abort an abort. */ if (!conn) { if (unknownService && (np->header.type != RX_PACKET_TYPE_ABORT)) - rxi_SendRawAbort(socket, host, port, RX_INVALID_OPERATION, + rxi_SendRawAbort(socket, host, port, 1, RX_INVALID_OPERATION, np, 0); return np; } diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index 214f3079a..7c9551595 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -2552,7 +2552,8 @@ rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn, /* Send a raw abort packet, without any call or connection structures */ void rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port, - afs_int32 error, struct rx_packet *source, int istack) + afs_uint32 serial, afs_int32 error, + struct rx_packet *source, int istack) { struct rx_header theader; struct sockaddr_in addr; @@ -2561,7 +2562,7 @@ rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port, memset(&theader, 0, sizeof(theader)); theader.epoch = htonl(source->header.epoch); theader.callNumber = htonl(source->header.callNumber); - theader.serial = htonl(1); + theader.serial = htonl(serial); theader.type = RX_PACKET_TYPE_ABORT; theader.serviceId = htons(source->header.serviceId); theader.securityIndex = source->header.securityIndex; diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index 8af530865..0af7ba85f 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -426,8 +426,8 @@ extern void rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn, struct rx_packet **list, int len, int istack); extern void rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port, - afs_int32 error, struct rx_packet *source, - int istack); + afs_uint32 serial, afs_int32 error, + struct rx_packet *source, int istack); extern struct rx_packet *rxi_SendSpecial(struct rx_call *call, struct rx_connection *conn, struct rx_packet *optionalPacket, -- 2.39.5