Skip to content

SUNRPC: Clean up port reuse behavior on reconnects

Vallish Vaidyeshwara linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2SUNRPC: Need to reuse non-reserved port for reconnectnet/sunrpc/xprtsock.c+3 -11 reply
2/2SUNRPC: Reconnect with new port on server initiated connection terminationnet/sunrpc/xprtsock.c+5 -06 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJacob StraussAlakesh Haloi
1/2R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] SUNRPC: Clean up port reuse behavior on reconnects

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(-)
Signature · 1 line
2.7.3.AMZN