fix: kernel crashed when delete a umounted folder

Close: I3MZZ6
Change-Id: Iab3919a2eebb44c82531a7fa7a2f688ec4bcc5a0
This commit is contained in:
chenwei 2021-04-20 15:03:53 +08:00
parent 296274b60f
commit c6e921241b
2 changed files with 8 additions and 2 deletions

View File

@ -145,6 +145,7 @@ int VfsJffs2Bind(struct Mount *mnt, struct Vnode *blkDriver, const void *data)
g_jffs2PartList[partNo] = blkDriver;
PRINTK("%s-%d: vnode=%p, inode=%p, i_nlink=%d\n", __FUNCTION__, __LINE__, pv, rootNode, rootNode->i_nlink);
LOS_MuxUnlock(&g_jffs2FsLock);
return 0;
@ -231,6 +232,7 @@ int VfsJffs2Lookup(struct Vnode *parentVnode, const char *path, int len, struct
(void)VfsHashInsert(newVnode, node->i_ino);
*ppVnode = newVnode;
PRINTK("%s-%d: vnode=%p, inode=%p, i_nlink=%d path=%s\n", __FUNCTION__, __LINE__, newVnode, node, node->i_nlink, path);
LOS_MuxUnlock(&g_jffs2FsLock);
return 0;
@ -269,6 +271,7 @@ int VfsJffs2Create(struct Vnode *parentVnode, const char *path, int mode, struct
(void)VfsHashInsert(newVnode, newNode->i_ino);
*ppVnode = newVnode;
PRINTK("%s-%d: vnode=%p, inode=%p, i_nlink=%d path=%s\n", __FUNCTION__, __LINE__, newVnode, newNode, newNode->i_nlink, path);
LOS_MuxUnlock(&g_jffs2FsLock);
return 0;
@ -539,6 +542,7 @@ int VfsJffs2Mkdir(struct Vnode *parentNode, const char *dirName, mode_t mode, st
*ppVnode = newVnode;
(void)VfsHashInsert(newVnode, node->i_ino);
PRINTK("%s-%d: vnode=%p, inode=%p, i_nlink=%d path=%s\n", __FUNCTION__, __LINE__, newVnode, node, node->i_nlink, dirName);
LOS_MuxUnlock(&g_jffs2FsLock);

View File

@ -164,6 +164,7 @@ int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode)
VnodeDrop();
*newVnode = vnode;
PRINTK("%s-%d: vnode=%p userCount=%d inode=%p\n", __FUNCTION__, __LINE__, vnode, vnode->useCount, vnode->data);
return LOS_OK;
}
@ -179,11 +180,11 @@ int VnodeFree(struct Vnode *vnode)
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);
PRINTK("%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);
PRINTK("%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();
@ -203,6 +204,7 @@ int VnodeFree(struct Vnode *vnode)
vnode->vop->Reclaim(vnode);
}
PRINTK("%s-%d: vnode=%p userCount=%d inode=%p\n", __FUNCTION__, __LINE__, vnode, vnode->useCount, vnode->data);
LOS_ListDelete(&vnode->actFreeEntry);
memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode));
LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry);