summaryrefslogtreecommitdiff
path: root/fs/afs/cell.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-05-23 11:51:29 +0100
committerDavid Howells <dhowells@redhat.com>2018-05-23 11:51:29 +0100
commit1588def91d58bf70afe1acf9fc0331fa26e974f4 (patch)
treed018c9b539d1c789b4dc8bba4c59226a22433a2d /fs/afs/cell.c
parentc875c76a061df306ca82b69ba80b8da3ee758c87 (diff)
afs: Mark afs_net::ws_cell as __rcu and set using rcu functions
The afs_net::ws_cell member is sometimes used under RCU conditions from within an seq-readlock. It isn't, however, marked __rcu and it isn't set using the proper RCU barrier-imposing functions. Fix this by annotating it with __rcu and using appropriate barriers to make sure accesses are correctly ordered. Without this, the code can produce the following warning: >> fs/afs/proc.c:151:24: sparse: incompatible types in comparison expression (different address spaces) Fixes: f044c8847bb6 ("afs: Lay the groundwork for supporting network namespaces") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/cell.c')
-rw-r--r--fs/afs/cell.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index fdf4c36cff79..80fd127239ce 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -341,8 +341,8 @@ int afs_cell_init(struct afs_net *net, const char *rootcell)
/* install the new cell */
write_seqlock(&net->cells_lock);
- old_root = net->ws_cell;
- net->ws_cell = new_root;
+ old_root = rcu_access_pointer(net->ws_cell);
+ rcu_assign_pointer(net->ws_cell, new_root);
write_sequnlock(&net->cells_lock);
afs_put_cell(net, old_root);
@@ -755,8 +755,8 @@ void afs_cell_purge(struct afs_net *net)
_enter("");
write_seqlock(&net->cells_lock);
- ws = net->ws_cell;
- net->ws_cell = NULL;
+ ws = rcu_access_pointer(net->ws_cell);
+ RCU_INIT_POINTER(net->ws_cell, NULL);
write_sequnlock(&net->cells_lock);
afs_put_cell(net, ws);