mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
DEVEL15-windows-dbg-refcount-20061016
more code to assist in debugging scache refcount leaks (cherry picked from commit 740013fcbf2273287414dd399b3020ed09cf07ba)
This commit is contained in:
parent
c5eea6d77a
commit
8e2bafd7c1
@ -534,8 +534,13 @@ cm_scache_t *cm_FindSCache(cm_fid_t *fidp)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
long cm_GetSCacheDbg(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
||||||
|
cm_req_t *reqp, char * file, long line)
|
||||||
|
#else
|
||||||
long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
||||||
cm_req_t *reqp)
|
cm_req_t *reqp)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
long hash;
|
long hash;
|
||||||
cm_scache_t *scp;
|
cm_scache_t *scp;
|
||||||
@ -563,6 +568,10 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
|||||||
lock_ObtainWrite(&cm_scacheLock);
|
lock_ObtainWrite(&cm_scacheLock);
|
||||||
for (scp=cm_data.hashTablep[hash]; scp; scp=scp->nextp) {
|
for (scp=cm_data.hashTablep[hash]; scp; scp=scp->nextp) {
|
||||||
if (cm_FidCmp(fidp, &scp->fid) == 0) {
|
if (cm_FidCmp(fidp, &scp->fid) == 0) {
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_GetSCache (1) outScpp 0x%p ref %d", file, line, scp, scp->refCount);
|
||||||
|
osi_Log1(afsd_logp,"cm_GetSCache (1) outScpp 0x%p", scp);
|
||||||
|
#endif
|
||||||
cm_HoldSCacheNoLock(scp);
|
cm_HoldSCacheNoLock(scp);
|
||||||
*outScpp = scp;
|
*outScpp = scp;
|
||||||
cm_AdjustLRU(scp);
|
cm_AdjustLRU(scp);
|
||||||
@ -658,6 +667,10 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
|||||||
#endif
|
#endif
|
||||||
*outScpp = scp;
|
*outScpp = scp;
|
||||||
lock_ReleaseWrite(&cm_scacheLock);
|
lock_ReleaseWrite(&cm_scacheLock);
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_GetSCache (2) outScpp 0x%p ref %d", file, line, scp, scp->refCount);
|
||||||
|
osi_Log1(afsd_logp,"cm_GetSCache (2) outScpp 0x%p", scp);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// end of yj code
|
// end of yj code
|
||||||
@ -681,6 +694,10 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
|||||||
*/
|
*/
|
||||||
for (scp=cm_data.hashTablep[hash]; scp; scp=scp->nextp) {
|
for (scp=cm_data.hashTablep[hash]; scp; scp=scp->nextp) {
|
||||||
if (cm_FidCmp(fidp, &scp->fid) == 0) {
|
if (cm_FidCmp(fidp, &scp->fid) == 0) {
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_GetSCache (3) outScpp 0x%p ref %d", file, line, scp, scp->refCount);
|
||||||
|
osi_Log1(afsd_logp,"cm_GetSCache (3) outScpp 0x%p", scp);
|
||||||
|
#endif
|
||||||
cm_HoldSCacheNoLock(scp);
|
cm_HoldSCacheNoLock(scp);
|
||||||
osi_assert(scp->volp == volp);
|
osi_assert(scp->volp == volp);
|
||||||
cm_AdjustLRU(scp);
|
cm_AdjustLRU(scp);
|
||||||
@ -749,6 +766,10 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
|
|||||||
|
|
||||||
/* now we have a held scache entry; just return it */
|
/* now we have a held scache entry; just return it */
|
||||||
*outScpp = scp;
|
*outScpp = scp;
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_GetSCache (4) outScpp 0x%p ref %d", file, line, scp, scp->refCount);
|
||||||
|
osi_Log1(afsd_logp,"cm_GetSCache (4) outScpp 0x%p", scp);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,10 +308,15 @@ typedef struct cm_scache {
|
|||||||
|
|
||||||
extern void cm_InitSCache(int, long);
|
extern void cm_InitSCache(int, long);
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
extern long cm_GetSCacheDbg(cm_fid_t *, cm_scache_t **, struct cm_user *,
|
||||||
|
struct cm_req *, char *, long);
|
||||||
|
|
||||||
|
#define cm_GetSCache(a,b,c,d) cm_GetSCacheDbg(a,b,c,d,__FILE__,__LINE__)
|
||||||
|
#else
|
||||||
extern long cm_GetSCache(cm_fid_t *, cm_scache_t **, struct cm_user *,
|
extern long cm_GetSCache(cm_fid_t *, cm_scache_t **, struct cm_user *,
|
||||||
struct cm_req *);
|
struct cm_req *);
|
||||||
|
#endif
|
||||||
extern void cm_PutSCache(cm_scache_t *);
|
|
||||||
|
|
||||||
extern cm_scache_t *cm_GetNewSCache(void);
|
extern cm_scache_t *cm_GetNewSCache(void);
|
||||||
|
|
||||||
|
@ -1258,14 +1258,24 @@ int cm_ExpandSysName(char *inp, char *outp, long outSize, unsigned int index)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
long cm_LookupDbg(cm_scache_t *dscp, char *namep, long flags, cm_user_t *userp,
|
||||||
|
cm_req_t *reqp, cm_scache_t **outpScpp, char * file, long line)
|
||||||
|
#else
|
||||||
long cm_Lookup(cm_scache_t *dscp, char *namep, long flags, cm_user_t *userp,
|
long cm_Lookup(cm_scache_t *dscp, char *namep, long flags, cm_user_t *userp,
|
||||||
cm_req_t *reqp, cm_scache_t **outpScpp)
|
cm_req_t *reqp, cm_scache_t **outpScpp)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
long code;
|
long code;
|
||||||
char tname[256];
|
char tname[256];
|
||||||
int sysNameIndex = 0;
|
int sysNameIndex = 0;
|
||||||
cm_scache_t *scp = NULL;
|
cm_scache_t *scp = NULL;
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_Lookup dscp 0x%p ref %d", file, line, dscp, dscp->refCount, file, line);
|
||||||
|
osi_Log2(afsd_logp, "cm_Lookup dscp 0x%p ref %d", dscp, dscp->refCount);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( stricmp(namep,SMB_IOCTL_FILENAME_NOSLASH) == 0 ) {
|
if ( stricmp(namep,SMB_IOCTL_FILENAME_NOSLASH) == 0 ) {
|
||||||
if (flags & CM_FLAG_CHECKPATH)
|
if (flags & CM_FLAG_CHECKPATH)
|
||||||
return CM_ERROR_NOSUCHPATH;
|
return CM_ERROR_NOSUCHPATH;
|
||||||
@ -1277,6 +1287,11 @@ long cm_Lookup(cm_scache_t *dscp, char *namep, long flags, cm_user_t *userp,
|
|||||||
code = cm_ExpandSysName(namep, tname, sizeof(tname), sysNameIndex);
|
code = cm_ExpandSysName(namep, tname, sizeof(tname), sysNameIndex);
|
||||||
if (code > 0) {
|
if (code > 0) {
|
||||||
code = cm_LookupInternal(dscp, tname, flags, userp, reqp, &scp);
|
code = cm_LookupInternal(dscp, tname, flags, userp, reqp, &scp);
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_LookupInternal (1) code 0x%x dscp 0x%p ref %d scp 0x%p ref %d", file, line, code, dscp, dscp->refCount, scp, scp ? scp->refCount : 0);
|
||||||
|
osi_Log3(afsd_logp, "cm_LookupInternal (1) code 0x%x dscp 0x%p scp 0x%p", code, dscp, scp);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
*outpScpp = scp;
|
*outpScpp = scp;
|
||||||
return 0;
|
return 0;
|
||||||
@ -1286,7 +1301,13 @@ long cm_Lookup(cm_scache_t *dscp, char *namep, long flags, cm_user_t *userp,
|
|||||||
scp = NULL;
|
scp = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return cm_LookupInternal(dscp, namep, flags, userp, reqp, outpScpp);
|
code = cm_LookupInternal(dscp, namep, flags, userp, reqp, &scp);
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_LookupInternal (2) code 0x%x dscp 0x%p ref %d scp 0x%p ref %d", file, line, code, dscp, dscp->refCount, scp, scp ? scp->refCount : 0);
|
||||||
|
osi_Log3(afsd_logp, "cm_LookupInternal (2) code 0x%x dscp 0x%p scp 0x%p", code, dscp, scp);
|
||||||
|
#endif
|
||||||
|
*outpScpp = scp;
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1517,9 +1538,14 @@ long cm_AssembleLink(cm_scache_t *linkScp, char *pathSuffixp,
|
|||||||
lock_ReleaseMutex(&linkScp->mx);
|
lock_ReleaseMutex(&linkScp->mx);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
long cm_NameIDbg(cm_scache_t *rootSCachep, char *pathp, long flags,
|
||||||
|
cm_user_t *userp, char *tidPathp, cm_req_t *reqp, cm_scache_t **outScpp,
|
||||||
|
char * file, long line)
|
||||||
|
#else
|
||||||
long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
|
long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
|
||||||
cm_user_t *userp, char *tidPathp, cm_req_t *reqp, cm_scache_t **outScpp)
|
cm_user_t *userp, char *tidPathp, cm_req_t *reqp, cm_scache_t **outScpp)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
long code;
|
long code;
|
||||||
char *tp; /* ptr moving through input buffer */
|
char *tp; /* ptr moving through input buffer */
|
||||||
@ -1540,8 +1566,12 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
|
|||||||
int extraFlag; /* avoid chasing mt pts for dir cmd */
|
int extraFlag; /* avoid chasing mt pts for dir cmd */
|
||||||
int phase = 1; /* 1 = tidPathp, 2 = pathp */
|
int phase = 1; /* 1 = tidPathp, 2 = pathp */
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_NameI rootscp 0x%p ref %d", file, line, rootSCachep, rootSCachep->refCount);
|
||||||
osi_Log4(afsd_logp,"cm_NameI rootscp 0x%p path %s tidpath %s flags 0x%x",
|
osi_Log4(afsd_logp,"cm_NameI rootscp 0x%p path %s tidpath %s flags 0x%x",
|
||||||
rootSCachep, pathp, tidPathp, flags);
|
rootSCachep, pathp ? pathp : "<NULL>", tidPathp ? tidPathp : "<NULL>",
|
||||||
|
flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
tp = tidPathp;
|
tp = tidPathp;
|
||||||
if (tp == NULL) {
|
if (tp == NULL) {
|
||||||
@ -1750,6 +1780,10 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
|
|||||||
*outScpp = tscp;
|
*outScpp = tscp;
|
||||||
else if (tscp)
|
else if (tscp)
|
||||||
cm_ReleaseSCache(tscp);
|
cm_ReleaseSCache(tscp);
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
afsi_log("%s:%d cm_NameI code 0x%x outScpp 0x%p ref %d", file, line, code, *outScpp, (*outScpp)->refCount);
|
||||||
|
#endif
|
||||||
osi_Log2(afsd_logp,"cm_NameI code 0x%x outScpp 0x%p", code, *outScpp);
|
osi_Log2(afsd_logp,"cm_NameI code 0x%x outScpp 0x%p", code, *outScpp);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -65,12 +65,23 @@ extern void cm_Gen8Dot3Name(struct cm_dirEntry *dep, char *shortName,
|
|||||||
extern long cm_ReadMountPoint(cm_scache_t *scp, cm_user_t *userp,
|
extern long cm_ReadMountPoint(cm_scache_t *scp, cm_user_t *userp,
|
||||||
cm_req_t *reqp);
|
cm_req_t *reqp);
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
extern long cm_NameIDbg(cm_scache_t *rootSCachep, char *pathp, long flags,
|
||||||
|
cm_user_t *userp, char *tidPathp, cm_req_t *reqp,
|
||||||
|
cm_scache_t **outScpp, char *, long);
|
||||||
|
|
||||||
|
extern long cm_LookupDbg(cm_scache_t *dscp, char *namep, long flags,
|
||||||
|
cm_user_t *userp, cm_req_t *reqp, cm_scache_t **outpScpp, char *, long);
|
||||||
|
|
||||||
|
#define cm_Lookup(a,b,c,d,e,f) cm_LookupDbg(a,b,c,d,e,f,__FILE__,__LINE__)
|
||||||
|
#define cm_NameI(a,b,c,d,e,f,g) cm_NameIDbg(a,b,c,d,e,f,g,__FILE__,__LINE__)
|
||||||
|
#else
|
||||||
extern long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
|
extern long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags,
|
||||||
cm_user_t *userp, char *tidPathp, cm_req_t *reqp,
|
cm_user_t *userp, char *tidPathp, cm_req_t *reqp,
|
||||||
cm_scache_t **outScpp);
|
cm_scache_t **outScpp);
|
||||||
|
|
||||||
extern long cm_Lookup(cm_scache_t *dscp, char *namep, long flags,
|
extern long cm_Lookup(cm_scache_t *dscp, char *namep, long flags,
|
||||||
cm_user_t *userp, cm_req_t *reqp, cm_scache_t **outpScpp);
|
cm_user_t *userp, cm_req_t *reqp, cm_scache_t **outpScpp);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern long cm_LookupInternal(cm_scache_t *dscp, char *namep, long flags,
|
extern long cm_LookupInternal(cm_scache_t *dscp, char *namep, long flags,
|
||||||
cm_user_t *userp, cm_req_t *reqp,
|
cm_user_t *userp, cm_req_t *reqp,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user