diff options
author | David Howells <dhowells@redhat.com> | 2017-11-02 16:27:50 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2017-11-13 16:38:18 +0100 |
commit | 989782dcdc91a5e6d5999c7a52a84a60a0811e56 (patch) | |
tree | 138ed46554536280e0d4d1834a16c28740e8cdae /fs/afs/proc.c | |
parent | afs: Overhaul permit caching (diff) | |
download | linux-989782dcdc91a5e6d5999c7a52a84a60a0811e56.tar.xz linux-989782dcdc91a5e6d5999c7a52a84a60a0811e56.zip |
afs: Overhaul cell database management
Overhaul the way that the in-kernel AFS client keeps track of cells in the
following manner:
(1) Cells are now held in an rbtree to make walking them quicker and RCU
managed (though this is probably overkill).
(2) Cells now have a manager work item that:
(A) Looks after fetching and refreshing the VL server list.
(B) Manages cell record lifetime, including initialising and
destruction.
(B) Manages cell record caching whereby threads are kept around for a
certain time after last use and then destroyed.
(C) Manages the FS-Cache index cookie for a cell. It is not permitted
for a cookie to be in use twice, so we have to be careful to not
allow a new cell record to exist at the same time as an old record
of the same name.
(3) Each AFS network namespace is given a manager work item that manages
the cells within it, maintaining a single timer to prod cells into
updating their DNS records.
This uses the reduce_timer() facility to make the timer expire at the
soonest timed event that needs happening.
(4) When a module is being unloaded, cells and cell managers are now
counted out using dec_after_work() to make sure the module text is
pinned until after the data structures have been cleaned up.
(5) Each cell's VL server list is now protected by a seqlock rather than a
semaphore.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/proc.c')
-rw-r--r-- | fs/afs/proc.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index d00d550ff2ef..08565429615d 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -186,7 +186,7 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos) { struct afs_net *net = afs_seq2net(m); - down_read(&net->proc_cells_sem); + rcu_read_lock(); return seq_list_start_head(&net->proc_cells, *_pos); } @@ -205,9 +205,7 @@ static void *afs_proc_cells_next(struct seq_file *m, void *v, loff_t *pos) */ static void afs_proc_cells_stop(struct seq_file *m, void *v) { - struct afs_net *net = afs_seq2net(m); - - up_read(&net->proc_cells_sem); + rcu_read_unlock(); } /* @@ -225,8 +223,7 @@ static int afs_proc_cells_show(struct seq_file *m, void *v) } /* display one cell per line on subsequent lines */ - seq_printf(m, "%3d %s\n", - atomic_read(&cell->usage), cell->name); + seq_printf(m, "%3u %s\n", atomic_read(&cell->usage), cell->name); return 0; } @@ -279,13 +276,13 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, if (strcmp(kbuf, "add") == 0) { struct afs_cell *cell; - cell = afs_cell_create(net, name, strlen(name), args, false); + cell = afs_lookup_cell(net, name, strlen(name), args, true); if (IS_ERR(cell)) { ret = PTR_ERR(cell); goto done; } - afs_put_cell(net, cell); + set_bit(AFS_CELL_FL_NO_GC, &cell->flags); printk("kAFS: Added new cell '%s'\n", name); } else { goto inval; @@ -354,7 +351,7 @@ int afs_proc_cell_setup(struct afs_net *net, struct afs_cell *cell) { struct proc_dir_entry *dir; - _enter("%p{%s}", cell, cell->name); + _enter("%p{%s},%p", cell, cell->name, net->proc_afs); dir = proc_mkdir(cell->name, net->proc_afs); if (!dir) |