curproc-20060313
authorJim Rees <rees@umich.edu>
Mon, 13 Mar 2006 16:26:27 +0000 (16:26 +0000)
committerJim Rees <rees@umich.edu>
Mon, 13 Mar 2006 16:26:27 +0000 (16:26 +0000)
Possible fix for curproc panic reported by ober@linbsd.org.
My guess is it will fix this one but others are lurking.

src/afs/OBSD/osi_groups.c
src/afs/OBSD/osi_machdep.h

index dc320d9..9633511 100644 (file)
@@ -47,10 +47,10 @@ Afs_xsetgroups(p, args, retval)
     struct vrequest treq;
 
     AFS_STATCNT(afs_xsetgroups);
-    AFS_GLOCK();
+    AFS_GLOCKP(p);
 
     code = afs_InitReq(&treq, p->p_rcred);
-    AFS_GUNLOCK();
+    AFS_GUNLOCKP(p);
     if (code)
        return code;
 
@@ -61,10 +61,10 @@ Afs_xsetgroups(p, args, retval)
      */
     if (PagInCred(p->p_rcred) == NOPAG) {
        if (((treq.uid >> 24) & 0xff) == 'A') {
-           AFS_GLOCK();
+           AFS_GLOCKP(p);
            /* we've already done a setpag, so now we redo it */
            AddPag(p, treq.uid, &p->p_rcred);
-           AFS_GUNLOCK();
+           AFS_GUNLOCKP(p);
        }
     }
     return code;
index f7e486b..048ec33 100644 (file)
@@ -112,28 +112,30 @@ extern int afs_vget();
 
 #ifdef KERNEL
 
+#define AFS_GLOCK() AFS_GLOCKP(curproc)
+#define AFS_GUNLOCK() AFS_GUNLOCKP(curproc)
 #ifdef AFS_GLOBAL_SUNLOCK
 extern struct proc *afs_global_owner;
 extern struct lock afs_global_lock;
-#define AFS_GLOCK() \
+#define AFS_GLOCKP(p) \
     do { \
-        osi_Assert(curproc); \
-       afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
+        osi_Assert(p); \
+       afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, (p)); \
         osi_Assert(afs_global_owner == NULL); \
-       afs_global_owner = curproc; \
+       afs_global_owner = (p); \
     } while (0)
-#define AFS_GUNLOCK() \
+#define AFS_GUNLOCKP(p) \
     do { \
-        osi_Assert(curproc); \
-       osi_Assert(afs_global_owner == curproc); \
+        osi_Assert(p); \
+       osi_Assert(afs_global_owner == (p)); \
         afs_global_owner = NULL; \
-        afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
+        afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, (p)); \
     } while(0)
 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
 #else
 extern struct lock afs_global_lock;
-#define AFS_GLOCK()
-#define AFS_GUNLOCK()
+#define AFS_GLOCKP(p)
+#define AFS_GUNLOCKP(p)
 #define AFS_ASSERT_GLOCK()
 #define ISAFS_GLOCK() 1
 #endif