Bugfix: add vnode iteration debug feature for a bug
buginfo: when try to umount a nfs node, it may casue stack overflow. Change-Id: I7d96f74a770607c990ca5f51cb92fb2843a08d12
This commit is contained in:
parent
b56c8392fd
commit
7e0e46828b
|
@ -52,5 +52,6 @@ int PathCacheAllocDummy(struct Vnode *parent, struct Vnode **vnode, const char *
|
||||||
int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnode **vnode);
|
int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnode **vnode);
|
||||||
void VnodePathCacheFree(struct Vnode *vnode);
|
void VnodePathCacheFree(struct Vnode *vnode);
|
||||||
void PathCacheMemoryDump(void);
|
void PathCacheMemoryDump(void);
|
||||||
|
void PathCacheDump(void);
|
||||||
|
|
||||||
#endif /* _PATH_CACHE_H */
|
#endif /* _PATH_CACHE_H */
|
||||||
|
|
|
@ -54,7 +54,8 @@ void PathCacheDump(void)
|
||||||
LIST_HEAD *nhead = &g_pathCacheHashEntrys[i];
|
LIST_HEAD *nhead = &g_pathCacheHashEntrys[i];
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY(nc, nhead, struct PathCache, hashEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY(nc, nhead, struct PathCache, hashEntry) {
|
||||||
PRINTK(" pathCache dump hash %d item %s %p %d\n", i, nc->name, nc->parentVnode, nc->nameLen);
|
PRINTK(" pathCache dump hash %d item %s %p %p %d\n", i,
|
||||||
|
nc->name, nc->parentVnode, nc->childVnode, nc->nameLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PRINTK("-------->pathCache dump out\n");
|
PRINTK("-------->pathCache dump out\n");
|
||||||
|
|
|
@ -47,6 +47,7 @@ static struct VnodeOps g_devfsOps;
|
||||||
#define ENTRY_TO_VNODE(ptr) LOS_DL_LIST_ENTRY(ptr, struct Vnode, actFreeEntry)
|
#define ENTRY_TO_VNODE(ptr) LOS_DL_LIST_ENTRY(ptr, struct Vnode, actFreeEntry)
|
||||||
#define VNODE_LRU_COUNT 10
|
#define VNODE_LRU_COUNT 10
|
||||||
#define DEV_VNODE_MODE 0755
|
#define DEV_VNODE_MODE 0755
|
||||||
|
#define MAX_ITER_TIMES 10
|
||||||
|
|
||||||
int VnodesInit(void)
|
int VnodesInit(void)
|
||||||
{
|
{
|
||||||
|
@ -241,12 +242,29 @@ int VnodeFreeAll(struct Mount *mnt)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VOID VnodeIterDump(struct Vnode *vnode, int increase)
|
||||||
|
{
|
||||||
|
static int count = 0;
|
||||||
|
LIST_ENTRY *list = &vnode->parentPathCaches;
|
||||||
|
struct PathCache *pathCache = LOS_DL_LIST_ENTRY(list->pstNext, struct PathCache, parentEntry);
|
||||||
|
count += increase;
|
||||||
|
if (count >= MAX_ITER_TIMES) {
|
||||||
|
PRINTK("########## Vnode In Use Iteration ##########\n");
|
||||||
|
PRINTK("Iteration times: %d\n", count);
|
||||||
|
PRINTK("%p -- %s --> %p\n", vnode->parent, pathCache->name, vnode);
|
||||||
|
PathCacheDump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL VnodeInUseIter(struct Vnode *vnode)
|
BOOL VnodeInUseIter(struct Vnode *vnode)
|
||||||
{
|
{
|
||||||
struct Vnode *vp = NULL;
|
struct Vnode *vp = NULL;
|
||||||
struct PathCache *item = NULL;
|
struct PathCache *item = NULL;
|
||||||
struct PathCache *nextItem = NULL;
|
struct PathCache *nextItem = NULL;
|
||||||
|
|
||||||
|
VnodeIterDump(vnode, 1);
|
||||||
if (vnode->useCount > 0) {
|
if (vnode->useCount > 0) {
|
||||||
|
VnodeIterDump(vnode, -1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->childPathCaches, struct PathCache, childEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->childPathCaches, struct PathCache, childEntry) {
|
||||||
|
@ -255,9 +273,11 @@ BOOL VnodeInUseIter(struct Vnode *vnode)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (VnodeInUseIter(vp) == TRUE) {
|
if (VnodeInUseIter(vp) == TRUE) {
|
||||||
|
VnodeIterDump(vnode, -1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
VnodeIterDump(vnode, -1);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue