]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
afs: Give an afs_server object a ref on the afs_cell object it points to
authorDavid Howells <dhowells@redhat.com>
Tue, 18 Feb 2025 19:22:48 +0000 (19:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2025 17:25:29 +0000 (18:25 +0100)
commit0e8ed2d66da0d745b3970ff2c5219839c6a2c002
treeeb62bf51506b303ff383bb75020698ca433925c2
parenta38b394f465010568ebc23eb29e17b9e4f173ce2
afs: Give an afs_server object a ref on the afs_cell object it points to

[ Upstream commit 1f0fc3374f3345ff1d150c5c56ac5016e5d3826a ]

Give an afs_server object a ref on the afs_cell object it points to so that
the cell doesn't get deleted before the server record.

Whilst this is circular (cell -> vol -> server_list -> server -> cell), the
ref only pins the memory, not the lifetime as that's controlled by the
activity counter.  When the volume's activity counter reaches 0, it
detaches from the cell and discards its server list; when a cell's activity
counter reaches 0, it discards its root volume.  At that point, the
circularity is cut.

Fixes: d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20250218192250.296870-6-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/afs/server.c
include/trace/events/afs.h