cellservdb-proc-file-glocking-20090315
authorChaskiel M Grundman <cg2v@andrew.cmu.edu>
Sun, 15 Mar 2009 18:42:13 +0000 (18:42 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 15 Mar 2009 18:42:13 +0000 (18:42 +0000)
LICENSE IPL10
FIXES 124407

hold GLOCK appropriately when dealing with the proc file

src/afs/LINUX/osi_proc.c

index 75ee013..cf5497c 100644 (file)
@@ -46,6 +46,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
        struct afs_q *cq, *tq;
        loff_t n = 0;
 
+       AFS_GLOCK();
        ObtainReadLock(&afs_xcell);
        for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
                tq = QNext(cq);
@@ -54,8 +55,9 @@ static void *c_start(struct seq_file *m, loff_t *pos)
                        break;
        }
        if (cq == &CellLRU)
-               return NULL;
+               cq = NULL;
 
+       AFS_GUNLOCK();
        return cq;
 }
 
@@ -63,18 +65,22 @@ static void *c_next(struct seq_file *m, void *p, loff_t *pos)
 {
        struct afs_q *cq = p, *tq;
 
+       AFS_GLOCK();
        (*pos)++;
        tq = QNext(cq);
 
        if (tq == &CellLRU)
                return NULL;
 
+       AFS_GUNLOCK();
        return tq;
 }
 
 static void c_stop(struct seq_file *m, void *p)
 {
+        AFS_GLOCK();
        ReleaseReadLock(&afs_xcell);
+       AFS_GUNLOCK();
 }
 
 static int c_show(struct seq_file *m, void *p)