darwin notify avoid reentrant vfs context panic

if we own the context, don't get it again.

Change-Id: I1f574bc3dda764c7a9552f1adf0f64e50afc1d7d
Reviewed-on: http://gerrit.openafs.org/1668
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Derrick Brashear 2010-03-30 11:43:33 -04:00
parent 283c0f5347
commit da9b39c0a4

View File

@ -20,6 +20,8 @@
#endif
#ifdef AFS_DARWIN80_ENV
static thread_t vfs_context_owner;
/* works like PFlushVolumeData */
void
darwin_notify_perms(struct unixuser *auser, int event)
@ -30,6 +32,7 @@ darwin_notify_perms(struct unixuser *auser, int event)
int isglock = ISAFS_GLOCK();
struct vnode *vp;
struct vnode_attr va;
int isctxtowner = 0;
if (!afs_darwin_fsevents)
return;
@ -41,9 +44,12 @@ darwin_notify_perms(struct unixuser *auser, int event)
else
VATTR_SET(&va, va_uid, -2); /* nobody */
get_vfs_context();
if (!isglock)
AFS_GLOCK();
if (!(vfs_context_owner == current_thread())) {
get_vfs_context();
isctxtowner = 1;
}
loop:
ObtainReadLock(&afs_xvcache);
for (i = 0; i < VCSIZE; i++) {
@ -87,9 +93,10 @@ loop:
}
}
ReleaseReadLock(&afs_xvcache);
if (isctxtowner)
put_vfs_context();
if (!isglock)
AFS_GUNLOCK();
put_vfs_context();
}
int
@ -207,7 +214,6 @@ afsio_darwin_partialcopy(uio_t auio, int size)
vfs_context_t afs_osi_ctxtp;
int afs_osi_ctxtp_initialized;
static thread_t vfs_context_owner;
static proc_t vfs_context_curproc;
int vfs_context_ref;