summaryrefslogtreecommitdiff
path: root/fs/afs/server.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-11-02 15:27:46 +0000
committerDavid Howells <dhowells@redhat.com>2017-11-13 15:38:17 +0000
commit9ed900b1160ef306bc74ad0228d7ab199234c758 (patch)
treef2e3ed236dce6980e51e8216e9e06ffbf9c1d989 /fs/afs/server.c
parent49566f6f06b38d7c1a5c7eacc8a38c6ea2e36549 (diff)
afs: Push the net ns pointer to more places
Push the network namespace pointer to more places in AFS, including the afs_server structure (which doesn't hold a ref on the netns). In particular, afs_put_cell() now takes requires a net ns parameter so that it can safely alter the netns after decrementing the cell usage count - the cell will be deallocated by a background thread after being cached for a period, which means that it's not safe to access it after reducing its usage count. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/server.c')
-rw-r--r--fs/afs/server.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/afs/server.c b/fs/afs/server.c
index 33aeb527ac7e..d8044be913f0 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -85,6 +85,7 @@ static struct afs_server *afs_alloc_server(struct afs_cell *cell,
server = kzalloc(sizeof(struct afs_server), GFP_KERNEL);
if (server) {
atomic_set(&server->usage, 1);
+ server->net = cell->net;
server->cell = cell;
INIT_LIST_HEAD(&server->link);
@@ -245,10 +246,8 @@ static void afs_set_server_timer(struct afs_net *net, time64_t delay)
* destroy a server record
* - removes from the cell list
*/
-void afs_put_server(struct afs_server *server)
+void afs_put_server(struct afs_net *net, struct afs_server *server)
{
- struct afs_net *net = server->cell->net;
-
if (!server)
return;
@@ -290,7 +289,7 @@ static void afs_destroy_server(struct afs_net *net, struct afs_server *server)
ASSERTCMP(server->cb_break_head, ==, server->cb_break_tail);
ASSERTCMP(atomic_read(&server->cb_break_n), ==, 0);
- afs_put_cell(server->cell);
+ afs_put_cell(server->net, server->cell);
kfree(server);
afs_dec_servers_outstanding(net);
}