Fixed two bugs in the vnode disconnecting code found by bonefish+mmlr:

* vfs_disconnect_vnode() did not put away its vnode reference.
* disconnect_mount_or_vnode_fds() did always throw the current working
  directory of all apps on the same mount away, even if only a specific
  vnode should have been disconnected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23445 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-01-12 17:36:10 +00:00
parent 751232fbe0
commit a52c1759ac

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -1371,7 +1371,9 @@ disconnect_mount_or_vnode_fds(struct fs_mount *mount,
context->io_mutex.holder = thread_get_current_thread_id();
if (context->cwd != NULL && context->cwd->mount == mount) {
if (context->cwd != NULL && context->cwd->mount == mount
&& (vnodeToDisconnect == NULL
|| vnodeToDisconnect == context->cwd)) {
put_vnode(context->cwd);
// Note: We're only accessing the pointer, not the vnode itself
// in the lines below.
@ -3360,6 +3362,7 @@ vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID)
return status;
disconnect_mount_or_vnode_fds(vnode->mount, vnode);
put_vnode(vnode);
return B_OK;
}