From: Derrick Brashear Date: Tue, 30 Mar 2010 15:43:33 +0000 (-0400) Subject: darwin notify avoid reentrant vfs context panic X-Git-Tag: openafs-devel-1_5_73_1~4 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=da9b39c0a474c134f6e7c2bfd978bb7a70e770d0;p=packages%2Fo%2Fopenafs.git 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 Reviewed-by: Derrick Brashear --- diff --git a/src/afs/DARWIN/osi_misc.c b/src/afs/DARWIN/osi_misc.c index 9ec11bec6..929f4541a 100644 --- a/src/afs/DARWIN/osi_misc.c +++ b/src/afs/DARWIN/osi_misc.c @@ -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;