diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index 2d489e1200..6a030badd2 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -1422,27 +1422,41 @@ void cm_AFSFidFromFid(AFSFid *afsFidp, cm_fid_t *fidp) afsFidp->Unique = fidp->unique; } +#ifdef DEBUG_REFCOUNT +void cm_HoldSCacheNoLockDbg(cm_scache_t *scp, char * file, long line) +#else void cm_HoldSCacheNoLock(cm_scache_t *scp) +#endif { osi_assert(scp != 0); scp->refCount++; #ifdef DEBUG_REFCOUNT osi_Log2(afsd_logp,"cm_HoldSCacheNoLock scp 0x%p ref %d",scp, scp->refCount); + afsi_log("%s:%d cm_HoldSCacheNoLock scp 0x%p, ref %d", file, line, scp, scp->refCount); #endif } +#ifdef DEBUG_REFCOUNT +void cm_HoldSCacheDbg(cm_scache_t *scp, char * file, long line) +#else void cm_HoldSCache(cm_scache_t *scp) +#endif { osi_assert(scp != 0); lock_ObtainWrite(&cm_scacheLock); scp->refCount++; #ifdef DEBUG_REFCOUNT osi_Log2(afsd_logp,"cm_HoldSCache scp 0x%p ref %d",scp, scp->refCount); + afsi_log("%s:%d cm_HoldSCache scp 0x%p ref %d", file, line, scp, scp->refCount); #endif lock_ReleaseWrite(&cm_scacheLock); } +#ifdef DEBUG_REFCOUNT +void cm_ReleaseSCacheNoLockDbg(cm_scache_t *scp, char * file, long line) +#else void cm_ReleaseSCacheNoLock(cm_scache_t *scp) +#endif { osi_assert(scp != NULL); if (scp->refCount == 0) @@ -1450,10 +1464,15 @@ void cm_ReleaseSCacheNoLock(cm_scache_t *scp) osi_assert(scp->refCount-- >= 0); #ifdef DEBUG_REFCOUNT osi_Log2(afsd_logp,"cm_ReleaseSCacheNoLock scp 0x%p ref %d",scp,scp->refCount); + afsi_log("%s:%d cm_ReleaseSCacheNoLock scp 0x%p ref %d", file, line, scp, scp->refCount); #endif } +#ifdef DEBUG_REFCOUNT +void cm_ReleaseSCacheDbg(cm_scache_t *scp, char * file, long line) +#else void cm_ReleaseSCache(cm_scache_t *scp) +#endif { osi_assert(scp != NULL); lock_ObtainWrite(&cm_scacheLock); @@ -1463,6 +1482,7 @@ void cm_ReleaseSCache(cm_scache_t *scp) scp->refCount--; #ifdef DEBUG_REFCOUNT osi_Log2(afsd_logp,"cm_ReleaseSCache scp 0x%p ref %d",scp,scp->refCount); + afsi_log("%s:%d cm_ReleaseSCache scp 0x%p ref %d", file, line, scp, scp->refCount); #endif lock_ReleaseWrite(&cm_scacheLock); } diff --git a/src/WINNT/afsd/cm_scache.h b/src/WINNT/afsd/cm_scache.h index fb6599adfa..a4c83a2a8a 100644 --- a/src/WINNT/afsd/cm_scache.h +++ b/src/WINNT/afsd/cm_scache.h @@ -323,6 +323,20 @@ extern void cm_MergeStatus(cm_scache_t *, struct AFSFetchStatus *, struct AFSVol extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *); +#ifdef DEBUG_REFCOUNT +extern void cm_HoldSCacheNoLockDbg(cm_scache_t *, char *, long); + +extern void cm_HoldSCacheDbg(cm_scache_t *, char *, long); + +extern void cm_ReleaseSCacheNoLockDbg(cm_scache_t *, char *, long); + +extern void cm_ReleaseSCacheDbg(cm_scache_t *, char *, long); + +#define cm_HoldSCacheNoLock(scp) cm_HoldSCacheNoLockDbg(scp, __FILE__, __LINE__) +#define cm_HoldSCache(scp) cm_HoldSCacheDbg(scp, __FILE__, __LINE__) +#define cm_ReleaseSCacheNoLock(scp) cm_ReleaseSCacheNoLockDbg(scp, __FILE__, __LINE__) +#define cm_ReleaseSCache(scp) cm_ReleaseSCacheDbg(scp, __FILE__, __LINE__) +#else extern void cm_HoldSCacheNoLock(cm_scache_t *); extern void cm_HoldSCache(cm_scache_t *); @@ -330,7 +344,7 @@ extern void cm_HoldSCache(cm_scache_t *); extern void cm_ReleaseSCacheNoLock(cm_scache_t *); extern void cm_ReleaseSCache(cm_scache_t *); - +#endif extern cm_scache_t *cm_FindSCache(cm_fid_t *fidp); extern cm_scache_t *cm_FindSCacheParent(cm_scache_t *); diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index 0dfc45969b..5132d86110 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -1538,6 +1538,9 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, int extraFlag; /* avoid chasing mt pts for dir cmd */ int phase = 1; /* 1 = tidPathp, 2 = pathp */ + osi_Log4(afsd_logp,"cm_NameI rootscp 0x%p path %s tidpath %s flags 0x%x", + rootSCachep, pathp, tidPathp, flags); + tp = tidPathp; if (tp == NULL) { tp = pathp; @@ -1553,6 +1556,7 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, symlinkCount = 0; dirScp = NULL; + while (1) { tc = *tp++; @@ -1606,10 +1610,13 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, cm_ReleaseSCache(dirScp); if (psp) cm_FreeSpace(psp); - if (code == CM_ERROR_NOSUCHFILE && tscp->fileType == CM_SCACHETYPE_SYMLINK) + if (code == CM_ERROR_NOSUCHFILE && tscp->fileType == CM_SCACHETYPE_SYMLINK) { + osi_Log0(afsd_logp,"cm_NameI code CM_ERROR_NOSUCHPATH"); return CM_ERROR_NOSUCHPATH; - else + } else { + osi_Log1(afsd_logp,"cm_NameI code 0x%x", code); return code; + } } haveComponent = 0; /* component done */ if (dirScp) @@ -1657,6 +1664,7 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, } if (psp) cm_FreeSpace(psp); + osi_Log0(afsd_logp,"cm_NameI code CM_ERROR_TOO_MANY_SYMLINKS"); return CM_ERROR_TOO_MANY_SYMLINKS; } if (tc == 0) @@ -1740,6 +1748,7 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, *outScpp = tscp; else if (tscp) cm_ReleaseSCache(tscp); + osi_Log2(afsd_logp,"cm_NameI code 0x%x outScpp 0x%p", code, *outScpp); return code; }