afs: Fix the by-UUID server tree to allow servers with the same UUID
authorDavid Howells <dhowells@redhat.com>
Wed, 27 May 2020 14:51:30 +0000 (15:51 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 4 Jun 2020 14:37:57 +0000 (15:37 +0100)
commit3c4c4075fc61f5c37a0112b1dc8398025dc3e26a
treee78930a53e08984dc1b0f3519233baabd8a74c81
parent20325960f8750165964a6891a733e4cc15d19076
afs: Fix the by-UUID server tree to allow servers with the same UUID

Whilst it shouldn't happen, it is possible for multiple fileservers to
share a UUID, particularly if an entire cell has been duplicated, UUIDs and
all.  In such a case, it's not necessarily possible to map the effect of
the CB.InitCallBackState3 incoming RPC to a specific server unambiguously
by UUID and thus to a specific cell.

Indeed, there's a problem whereby multiple server records may need to
occupy the same spot in the rb_tree rooted in the afs_net struct.

Fix this by allowing servers to form a list, with the head of the list in
the tree.  When the front entry in the list is removed, the second in the
list just replaces it.  afs_init_callback_state() then just goes down the
line, poking each server in the list.

This means that some servers will be unnecessarily poked, unfortunately.
An alternative would be to route by call parameters.

Reported-by: Jeffrey Altman <jaltman@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Fixes: d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
fs/afs/callback.c
fs/afs/internal.h
fs/afs/server.c