summaryrefslogtreecommitdiff
path: root/fs/afs/volume.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-11-02 18:27:46 +0300
committerDavid Howells <dhowells@redhat.com>2017-11-13 18:38:17 +0300
commit9ed900b1160ef306bc74ad0228d7ab199234c758 (patch)
treef2e3ed236dce6980e51e8216e9e06ffbf9c1d989 /fs/afs/volume.c
parent49566f6f06b38d7c1a5c7eacc8a38c6ea2e36549 (diff)
downloadlinux-9ed900b1160ef306bc74ad0228d7ab199234c758.tar.xz
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/volume.c')
-rw-r--r--fs/afs/volume.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/afs/volume.c b/fs/afs/volume.c
index 3d5363e0b7e1..e2f0e8ec527d 100644
--- a/fs/afs/volume.c
+++ b/fs/afs/volume.c
@@ -154,7 +154,7 @@ error_discard:
up_write(&params->cell->vl_sem);
for (loop = volume->nservers - 1; loop >= 0; loop--)
- afs_put_server(volume->servers[loop]);
+ afs_put_server(params->net, volume->servers[loop]);
kfree(volume);
goto error;
@@ -163,7 +163,7 @@ error_discard:
/*
* destroy a volume record
*/
-void afs_put_volume(struct afs_net *net, struct afs_volume *volume)
+void afs_put_volume(struct afs_cell *cell, struct afs_volume *volume)
{
struct afs_vlocation *vlocation;
int loop;
@@ -179,7 +179,7 @@ void afs_put_volume(struct afs_net *net, struct afs_volume *volume)
/* to prevent a race, the decrement and the dequeue must be effectively
* atomic */
- down_write(&vlocation->cell->vl_sem);
+ down_write(&cell->vl_sem);
if (likely(!atomic_dec_and_test(&volume->usage))) {
up_write(&vlocation->cell->vl_sem);
@@ -189,16 +189,16 @@ void afs_put_volume(struct afs_net *net, struct afs_volume *volume)
vlocation->vols[volume->type] = NULL;
- up_write(&vlocation->cell->vl_sem);
+ up_write(&cell->vl_sem);
/* finish cleaning up the volume */
#ifdef CONFIG_AFS_FSCACHE
fscache_relinquish_cookie(volume->cache, 0);
#endif
- afs_put_vlocation(net, vlocation);
+ afs_put_vlocation(cell->net, vlocation);
for (loop = volume->nservers - 1; loop >= 0; loop--)
- afs_put_server(volume->servers[loop]);
+ afs_put_server(cell->net, volume->servers[loop]);
kfree(volume);
@@ -336,7 +336,7 @@ int afs_volume_release_fileserver(struct afs_vnode *vnode,
sizeof(volume->servers[loop]) *
(volume->nservers - loop));
volume->servers[volume->nservers] = NULL;
- afs_put_server(server);
+ afs_put_server(afs_v2net(vnode), server);
volume->rjservers++;
if (volume->nservers > 0)
@@ -350,7 +350,7 @@ int afs_volume_release_fileserver(struct afs_vnode *vnode,
* no longer registered
*/
up_write(&volume->server_sem);
- afs_put_server(server);
+ afs_put_server(afs_v2net(vnode), server);
_leave(" [completely rejected]");
return 1;
@@ -379,7 +379,7 @@ int afs_volume_release_fileserver(struct afs_vnode *vnode,
case -ENOMEM:
case -ENONET:
/* tell the caller to accept the result */
- afs_put_server(server);
+ afs_put_server(afs_v2net(vnode), server);
_leave(" [local failure]");
return 1;
}
@@ -388,7 +388,7 @@ int afs_volume_release_fileserver(struct afs_vnode *vnode,
try_next_server_upw:
up_write(&volume->server_sem);
try_next_server:
- afs_put_server(server);
+ afs_put_server(afs_v2net(vnode), server);
_leave(" [try next server]");
return 0;
}