Skip to content

Commit add117e

Browse files
dhowellskuba-moo
authored andcommitted
afs: Fix the server_list to unuse a displaced server rather than putting it
When allocating and building an afs_server_list struct object from a VLDB record, we look up each server address to get the server record for it - but a server may have more than one entry in the record and we discard the duplicate pointers. Currently, however, when we discard, we only put a server record, not unuse it - but the lookup got as an active-user count. The active-user count on an afs_server_list object determines its lifetime whereas the refcount keeps the memory backing it around. Failing to reduce the active-user counter prevents the record from being cleaned up and can lead to multiple copied being seen - and pointing to deleted afs_cell objects and other such things. Fix this by switching the incorrect 'put' to an 'unuse' instead. Without this, occasionally, a dead server record can be seen in /proc/net/afs/servers and list corruption may be observed: list_del corruption. prev->next should be ffff888102423e40, but was 0000000000000000. (prev=ffff88810140cd38) Fixes: 977e5f8 ("afs: Split the usage count on struct afs_server") Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: Simon Horman <[email protected]> cc: [email protected] Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 71f5409 commit add117e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/afs/server_list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ struct afs_server_list *afs_alloc_server_list(struct afs_volume *volume,
9797
break;
9898
if (j < slist->nr_servers) {
9999
if (slist->servers[j].server == server) {
100-
afs_put_server(volume->cell->net, server,
101-
afs_server_trace_put_slist_isort);
100+
afs_unuse_server(volume->cell->net, server,
101+
afs_server_trace_put_slist_isort);
102102
continue;
103103
}
104104

0 commit comments

Comments
 (0)