提交 45391fc3 编写于 作者: O openharmony_ci 提交者: Gitee

!29 [Desc]fix bug: kernel crashed after rmdir the umounted folder

Merge pull request !29 from LeonChan/lc-master
......@@ -130,7 +130,7 @@ DIR *opendir(const char *path)
}
if (ret < 0)
{
goto errout;
goto errout_with_count;
}
dir->fd_status = DIRENT_MAGIC;
dir->fd_root = vp;
......
......@@ -259,7 +259,9 @@ int mount(const char *source, const char *target,
mnt = MountAlloc(mountpt_vnode, (struct MountOps*)mops);
mountpt_vnode->useCount++;
ret = mops->Mount(mnt, device, data);
mountpt_vnode->useCount--;
if (ret != 0)
{
/* The vnode is unhappy with the blkdrvr for some reason. Back out
......
......@@ -85,9 +85,6 @@ BOOL fs_in_use(struct Mount *mnt, const char *target)
return VnodeInUseIter(mnt->vnodeCovered);
}
struct Vnode *g_coveredVnodeList[100];
int g_coveredVnodeTop = 0;
int umount(const char *target)
{
struct Vnode *mountpt_vnode = NULL;
......@@ -195,10 +192,6 @@ int umount(const char *target)
#endif
covered_vnode->newMount = NULL;
covered_vnode->flag &= ~(VNODE_FLAG_MOUNT_NEW);
if (g_coveredVnodeTop < 100)
{
g_coveredVnodeList[g_coveredVnodeTop++] = covered_vnode;
}
VnodeDrop();
return OK;
......
......@@ -50,8 +50,6 @@
#include "fs/path_cache.h"
#include "fs/vfs_util.h"
struct Vnode *g_parentOfCoveredVnode = NULL;
/****************************************************************************
* Private Functions
****************************************************************************/
......@@ -141,11 +139,6 @@ int do_mkdir(int dirfd, const char *pathname, mode_t mode)
// alloc name cache failed is not a critical problem, let it go.
PRINT_ERR("alloc path cache %s failed\n", dirname);
}
if (!strcmp(dirname, "kernel"))
{
PRINT_ERR("%s-%d: vnode_of_kernel: %p, inode=%p \n", __FUNCTION__, __LINE__, vnode, vnode->data);
g_parentOfCoveredVnode = vnode;
}
parentVnode->useCount--;
VnodeDrop();
out:
......
......@@ -158,6 +158,7 @@ static int do_creat(struct Vnode **node, char *fullpath, mode_t mode)
ret = -ENOSYS;
}
parentNode->useCount--;
if (ret < 0)
{
return ret;
......@@ -235,7 +236,6 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
goto errout_without_count;
}
ret = do_creat(&vnode, fullpath, mode);
vnode->useCount--;
if (ret != OK)
{
VnodeDrop();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册