summary refs log tree commit diff
path: root/fs/afs/super.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/super.c
parent49566f6f06b38d7c1a5c7eacc8a38c6ea2e36549 (diff)
downloadlinux-9ed900b1160ef306bc74ad0228d7ab199234c758.tar.gz
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/super.c')
-rw-r--r--fs/afs/super.c12
1 files changed, 6 insertions, 6 deletions
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);