提交 75a85e44 编写于 作者: O openharmony_ci 提交者: Gitee

!151 [Desc] add debug code to fix bug: kernel crashed after rmdir the umounted...

!151 [Desc] add debug code to fix bug: kernel crashed after rmdir the umounted folder, parentVnode->data null
Merge pull request !151 from LeonChan/lc-master
...@@ -593,6 +593,8 @@ int VfsJffs2Chattr(struct Vnode *pVnode, struct IATTR *attr) ...@@ -593,6 +593,8 @@ int VfsJffs2Chattr(struct Vnode *pVnode, struct IATTR *attr)
return ret; return ret;
} }
extern struct Vnode *g_parentOfCoveredVnode;
int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, char *path) int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, char *path)
{ {
int ret; int ret;
...@@ -603,6 +605,10 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, char *pa ...@@ -603,6 +605,10 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, char *pa
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER); 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, ret = jffs2_rmdir((struct jffs2_inode *)parentVnode->data, (struct jffs2_inode *)targetVnode->data,
(const unsigned char *)path); (const unsigned char *)path);
......
...@@ -93,6 +93,8 @@ static struct Vnode *GetFromFreeList(void) ...@@ -93,6 +93,8 @@ static struct Vnode *GetFromFreeList(void)
return vnode; return vnode;
} }
extern struct Vnode *g_parentOfCoveredVnode;
struct Vnode *VnodeReclaimLru(void) struct Vnode *VnodeReclaimLru(void)
{ {
struct Vnode *item = NULL; struct Vnode *item = NULL;
...@@ -107,11 +109,6 @@ struct Vnode *VnodeReclaimLru(void) ...@@ -107,11 +109,6 @@ struct Vnode *VnodeReclaimLru(void)
} }
if (VnodeFree(item) == LOS_OK) { 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++; releaseCount++;
} }
if (releaseCount >= VNODE_LRU_COUNT) { if (releaseCount >= VNODE_LRU_COUNT) {
...@@ -181,6 +178,14 @@ int VnodeFree(struct Vnode *vnode) ...@@ -181,6 +178,14 @@ int VnodeFree(struct Vnode *vnode)
struct PathCache *nextItem = NULL; struct PathCache *nextItem = NULL;
VnodeHold(); 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) { if (vnode->useCount > 0) {
VnodeDrop(); VnodeDrop();
return -EBUSY; return -EBUSY;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册