提交 f8303be9 编写于 作者: F Far

fix: VnodeInUseIter and VnodeFreeAll used to be recursive

Function VnodeInUseIter and VnodeFreeAll used to be recursive.
Now we traverse the current in-use vnode list to find the vnode in
1 filesystem

Close #I3NN3U
上级 9f69ada9
......@@ -220,7 +220,7 @@ int mount(const char *source, const char *target,
errcode = -EINVAL;
goto errout_with_lock;
}
if (mountpt_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)
if (mountpt_vnode->flag & VNODE_FLAG_MOUNT_NEW)
{
PRINT_ERR("can't mount to %s, already mounted.\n", target);
errcode = -EINVAL;
......@@ -280,8 +280,8 @@ int mount(const char *source, const char *target,
#endif
goto errout_with_mountpt;
}
mnt->vnodeBeCovered->flag |= VNODE_FLAG_MOUNT_NEW;
mnt->vnodeCovered->flag |= VNODE_FLAG_MOUNT_ORIGIN;
mnt->vnodeBeCovered->flag |= VNODE_FLAG_MOUNT_ORIGIN;
mnt->vnodeCovered->flag |= VNODE_FLAG_MOUNT_NEW;
mnt->ops = mops;
mnt->mountFlags = mountflags;
ret = strcpy_s(mnt->pathName, PATH_MAX, target);
......
......@@ -82,7 +82,7 @@ BOOL fs_in_use(struct Mount *mnt, const char *target)
return TRUE;
}
}
return VnodeInUseIter(mnt->vnodeCovered);
return VnodeInUseIter(mnt);
}
int umount(const char *target)
......@@ -113,7 +113,7 @@ int umount(const char *target)
goto errout;
}
/* Verify that the vnode is a mountpoint */
if (!mountpt_vnode || !(mountpt_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN))
if (!mountpt_vnode || !(mountpt_vnode->flag & VNODE_FLAG_MOUNT_NEW))
{
ret = -EINVAL;
goto errout;
......@@ -127,7 +127,7 @@ int umount(const char *target)
goto errout;
}
covered_vnode = mnt->vnodeBeCovered;
if (!covered_vnode || !(covered_vnode->flag & VNODE_FLAG_MOUNT_NEW))
if (!covered_vnode || !(covered_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN))
{
ret = -EINVAL;
goto errout;
......@@ -191,7 +191,7 @@ int umount(const char *target)
}
#endif
covered_vnode->newMount = NULL;
covered_vnode->flag &= ~(VNODE_FLAG_MOUNT_NEW);
covered_vnode->flag &= ~(VNODE_FLAG_MOUNT_ORIGIN);
VnodeDrop();
return OK;
......
......@@ -86,13 +86,13 @@ static int check_rename_target(struct Vnode *old_vnode, struct Vnode *old_parent
{
return -EXDEV;
}
if ((old_vnode->flag & VNODE_FLAG_MOUNT_NEW)
|| (old_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN))
if ((old_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)
|| (old_vnode->flag & VNODE_FLAG_MOUNT_NEW))
{
return -EBUSY;
}
if (new_vnode != NULL && ((new_vnode->flag & VNODE_FLAG_MOUNT_NEW)
|| (new_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)))
if (new_vnode != NULL && ((new_vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)
|| (new_vnode->flag & VNODE_FLAG_MOUNT_NEW)))
{
return -EBUSY;
}
......
......@@ -68,8 +68,8 @@ static int check_target(struct Vnode *vnode, char *name) {
return -EBUSY;
}
if ((vnode->flag & VNODE_FLAG_MOUNT_NEW)
|| (vnode->flag & VNODE_FLAG_MOUNT_ORIGIN))
if ((vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)
|| (vnode->flag & VNODE_FLAG_MOUNT_NEW))
{
return -EBUSY;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册