From 9ed900b1160ef306bc74ad0228d7ab199234c758 Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 2 Nov 2017 15:27:46 +0000 Subject: 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 --- fs/afs/super.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fs/afs/super.c') diff --git a/fs/afs/super.c b/fs/afs/super.c index e43f94ecc391..dd218f370359 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -206,7 +206,7 @@ static int afs_parse_options(struct afs_mount_params *params, false); if (IS_ERR(cell)) return PTR_ERR(cell); - afs_put_cell(params->cell); + afs_put_cell(params->net, params->cell); params->cell = cell; break; @@ -314,7 +314,7 @@ static int afs_parse_device_name(struct afs_mount_params *params, cellnamesz, cellnamesz, cellname ?: ""); return PTR_ERR(cell); } - afs_put_cell(params->cell); + afs_put_cell(params->net, params->cell); params->cell = cell; } @@ -409,8 +409,8 @@ static struct afs_super_info *afs_alloc_sbi(struct afs_mount_params *params) static void afs_destroy_sbi(struct afs_super_info *as) { if (as) { - afs_put_volume(as->net, as->volume); - afs_put_cell(as->cell); + afs_put_volume(as->cell, as->volume); + afs_put_cell(as->net, as->cell); afs_put_net(as->net); kfree(as); } @@ -494,7 +494,7 @@ static struct dentry *afs_mount(struct file_system_type *fs_type, as = NULL; } - afs_put_cell(params.cell); + afs_put_cell(params.net, params.cell); key_put(params.key); _leave(" = 0 [%p]", sb); return dget(sb->s_root); @@ -504,7 +504,7 @@ error_sb: error_as: afs_destroy_sbi(as); error: - afs_put_cell(params.cell); + afs_put_cell(params.net, params.cell); key_put(params.key); _leave(" = %d", ret); return ERR_PTR(ret); -- cgit v1.2.3