add debug code to fix bug: kernel crashed after rmdir the umounted folder, parent->data null
Change-Id: I44981eb9475feb4604ffe91244b4dff00f7d1548
This commit is contained in:
parent
a7c5abf64c
commit
296274b60f
|
@ -593,6 +593,8 @@ int VfsJffs2Chattr(struct Vnode *pVnode, struct IATTR *attr)
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern struct Vnode *g_parentOfCoveredVnode;
|
||||
|
||||
int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, char *path)
|
||||
{
|
||||
int ret;
|
||||
|
@ -603,6 +605,10 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, char *pa
|
|||
|
||||
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
|
||||
|
||||
if (parentVnode->data == NULL) {
|
||||
PRINT_ERR("%s-%d: rmdir parent of mounted vnode. vnode=%p userCount=%d inode=%p\n", __FUNCTION__, __LINE__, parentVnode, parentVnode->useCount, parentVnode->data);
|
||||
PRINT_ERR("%s-%d: global rmdir parent of mounted vnode. vnode=%p userCount=%d inode=%p\n", __FUNCTION__, __LINE__, g_parentOfCoveredVnode, g_parentOfCoveredVnode->useCount, g_parentOfCoveredVnode->data);
|
||||
}
|
||||
ret = jffs2_rmdir((struct jffs2_inode *)parentVnode->data, (struct jffs2_inode *)targetVnode->data,
|
||||
(const unsigned char *)path);
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ static struct Vnode *GetFromFreeList(void)
|
|||
return vnode;
|
||||
}
|
||||
|
||||
extern struct Vnode *g_parentOfCoveredVnode;
|
||||
|
||||
struct Vnode *VnodeReclaimLru(void)
|
||||
{
|
||||
struct Vnode *item = NULL;
|
||||
|
@ -106,11 +108,6 @@ struct Vnode *VnodeReclaimLru(void)
|
|||
}
|
||||
|
||||
if (VnodeFree(item) == LOS_OK) {
|
||||
for (int i = 0; i < g_coveredVnodeTop; i++) {
|
||||
if (item == g_coveredVnodeList[i]) {
|
||||
PRINT_ERR("%s-%d: reclaim mounted vnode. item=%p\n", __FUNCTION__, __LINE__, item);
|
||||
}
|
||||
}
|
||||
releaseCount++;
|
||||
}
|
||||
if (releaseCount >= VNODE_LRU_COUNT) {
|
||||
|
@ -180,6 +177,14 @@ int VnodeFree(struct Vnode *vnode)
|
|||
struct PathCache *nextItem = NULL;
|
||||
|
||||
VnodeHold();
|
||||
for (int i = 0; i < g_coveredVnodeTop; i++) {
|
||||
if (vnode == g_coveredVnodeList[i]) {
|
||||
PRINT_ERR("%s-%d: reclaim mounted vnode. vnode=%p userCount=%d inode=%p\n", __FUNCTION__, __LINE__, vnode, vnode->useCount, vnode->data);
|
||||
}
|
||||
}
|
||||
if (g_parentOfCoveredVnode == vnode) {
|
||||
PRINT_ERR("%s-%d: reclaim parent of mounted vnode. vnode=%p userCount=%d inode=%p\n", __FUNCTION__, __LINE__, vnode, vnode->useCount, vnode->data);
|
||||
}
|
||||
if (vnode->useCount > 0) {
|
||||
VnodeDrop();
|
||||
return -EBUSY;
|
||||
|
|
Loading…
Reference in New Issue