afs: Retry rxrpc calls with address rotation on network error

When a network error occurs when we attempt a call, we want to rotate the
set of addresses we have for that peer and try the call again.  Use the new
AF_RXRPC call-retrying facility to do this, thereby avoiding the need to
re-encrypt each time as this allows us to reuse the Tx-queue from the dead

This method will work for accessing alternate VL servers and the various
addresses available for a single FS server, but should not be used to go to
alternate FS servers since that has other implications (such as getting
callbacks on other servers).

To this end:

 (1) An 'address list' concept is introduced.  Address lists are RCU
     replaceable lists of addresses.

 (2) A cell's VL server address list can be loaded directly via insmod or
     echo to /proc/fs/afs/cells or dynamically from a DNS query for AFSDB
     or SRV records.

 (3) An FS server's address list, for the moment, has a single entry that
     is the key to the server list.  This will change in the future when a
     server is instead keyed on its UUID and the VL.GetAddrsU operation is

 (4) Anyone wanting to use a cell's VL server address must wait until the
     cell record comes online and has tried to obtain some addresses.

 (5) An 'address cursor' concept is introduced to handle stepping over the
     address list.  For client calls, this is driven from a wrapper around
     rxrpc_kernel_send_data().  It isn't used for CM service call replies as
     they have to go to the caller's address.

In the future, we might want to annotate the list with information about
how each address fares.  We might then want to propagate such annotations
over address list replacement.

Whilst we're at it, we allow IPv6 addresses to be specified in
colon-delimited lists by enclosing them in square brackets.

Signed-off-by: David Howells <>
12 files changed