Add lock annotations to afs_proc_cell_servers_{start,stop}
PATCH 1/1 Add lock annotations to afs_proc_cell_servers_{start,stop}
afs_proc_cell_servers_start acquires a lock, and afs_proc_cell_servers_stop releases that lock. Add lock annotations to these two functions so that sparse can check callers for lock pairing, and so that sparse will not complain about these functions since they intentionally use locks in this manner.
--- fs/afs/proc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/afs/proc.c +2 -0
@@ -775,6 +775,7 @@ static int afs_proc_cell_servers_release* first item */ static void *afs_proc_cell_servers_start (struct seq_file *m,loff_t *_pos) + __acquires(m->private->sv_lock) {struct list_head *_p;struct afs_cell *cell = m->private;
@@ -823,6 +824,7 @@ static void *afs_proc_cell_servers_next(* clean up after reading from the cells list */ static void afs_proc_cell_servers_stop (struct seq_file *p,void *v) + __releases(p->private->sv_lock) {struct afs_cell *cell = p->private;
Quoted 5 lines · Josh Triplett
afs_proc_cell_servers_startacquires a lock, andafs_proc_cell_servers_stopreleases that lock. Add lock annotations to these two functions so that sparse can check callers for lock pairing, and so that sparse will not complain about these functions since they intentionally use locks in this manner.
Looks reasonable, though I'm surprised you can get this sort of checking to work in sparse.