We have seen examples of NFSv4 client reconnections failing due to client source port reuse combined with stateful TCP state tracking in middleboxes. Commit 0f7a622ca616 ("rpc: xs_bind - do not bind when requesting a random ephemeral port"), commit 4dda9c8a5e34 ("SUNRPC: Set SO_REUSEPORT socket option for TCP connections"), and commit 1f4c17a03ba7 ("SUNRPC: Handle EADDRNOTAVAIL on connection failures") had unintended side effects of making port reuse dependent on whether that client uses reserved or non-reserved source ports. This series fixes the observed NFSv4 client reconnect failures by choosing a new source port regardless of which port range is in use for RST or FIN terminating the prior connection. This series does not restore the original always-reuse behavior that existed prior to commits mentioned above. Patch 1: -------- SUNRPC: Need to reuse non-reserved port for reconnect This patch restores the original behavior of port reuse in all scenarios. Patch 2: -------- SUNRPC: Reconnect with new port on server initiated connection termination Client uses a new port only in cases where server has terminated the connection explicitly using RST or FIN. Proposed outcome with this patch series: ---------------------------------------- ------------------------------------------------------------------ | Port type | Connection termination | Current | With this | | | type | behavior | patch series | ------------------------------------------------------------------ | Reserved | Network partition-DROP | Reuse port | Reuse port | ------------------------------------------------------------------ | Reserved | FIN from server | Reuse port | New port | ------------------------------------------------------------------ | Reserved | RST from server | Reuse port | New port | ------------------------------------------------------------------ | Non-Resv | Network partition-DROP | New port | Reuse port | ------------------------------------------------------------------ | Non-Resv | FIN from server | New port | New port | ------------------------------------------------------------------ | Non-Resv | RST from server | New port | New port | ------------------------------------------------------------------ net/sunrpc/xprtsock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.7.3.AMZN -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html