From a52c1759ac6f899186a557ba6ae0f27468a3ad8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 12 Jan 2008 17:36:10 +0000 Subject: [PATCH] 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 --- src/system/kernel/fs/vfs.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index f460513879..9328a0a51a 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -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; }