diff --git a/fs/dirent/fs_opendir.c b/fs/dirent/fs_opendir.c index 3f6c12cd6735c45a916bf0e355c1535d66723f72..780c218e0fc3fdaa3e66dba35ec17fcf2310f749 100644 --- a/fs/dirent/fs_opendir.c +++ b/fs/dirent/fs_opendir.c @@ -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; diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c index f4bc71f692457f9325b0112fece49417cf78d833..34b7f26c993fcadc71ad97b862e119a03d7784a7 100755 --- a/fs/mount/fs_mount.c +++ b/fs/mount/fs_mount.c @@ -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 diff --git a/fs/mount/fs_umount.c b/fs/mount/fs_umount.c index cde51a396249e9bc251b5a78d9055768dfd7c4d7..ede3b3656f80c1bda4ea9f9f7800a3a79e588072 100755 --- a/fs/mount/fs_umount.c +++ b/fs/mount/fs_umount.c @@ -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; diff --git a/fs/vfs/fs_mkdir.c b/fs/vfs/fs_mkdir.c index 382d6b3bef14b76cbe3b533ef46cea87716dc679..530e5746840420c016f9e222105f9fa89f54e046 100644 --- a/fs/vfs/fs_mkdir.c +++ b/fs/vfs/fs_mkdir.c @@ -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: diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index 9f007ad7c5be51b4c983f69ebb1a9ea39812a3c3..807704771d131ff265a989ce856af38024388b31 100755 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -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();