Skip to contentSkip to conversation

Add lock annotations to afs_proc_cell_servers_{start,stop}

PATCH In review Josh Triplett 2 participants 2 messages Jul 25, 2006 – Jul 26, 2006 Afs filesystem

lore
Share & tools
lore
#0 lore raw

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
index 101d21b..86463ec 100644
@@ -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;
 
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Josh Triplett

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.

Looks reasonable, though I'm surprised you can get this sort of checking to work in sparse.