From: Jim Rees Date: Mon, 13 Mar 2006 16:26:27 +0000 (+0000) Subject: curproc-20060313 X-Git-Tag: mp-rxtcp-20060314~4 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=9d3faf66086f47b0cd4551075b336ee0ea567979;p=packages%2Fo%2Fopenafs.git curproc-20060313 Possible fix for curproc panic reported by ober@linbsd.org. My guess is it will fix this one but others are lurking. --- diff --git a/src/afs/OBSD/osi_groups.c b/src/afs/OBSD/osi_groups.c index dc320d9fd..96335118c 100644 --- a/src/afs/OBSD/osi_groups.c +++ b/src/afs/OBSD/osi_groups.c @@ -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; diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index f7e486b67..048ec337d 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -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