* The covered vnode release was never put when it already was a mount point

during fs_mount(). This fixes bug #3934.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30773 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-05-16 21:28:12 +00:00
parent d69a73dfc7
commit ce4db6ae11
1 changed files with 9 additions and 15 deletions

View File

@ -7025,37 +7025,31 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags,
status = mount->volume->file_system->mount(mount->volume, device, flags,
args, &rootID);
if (status < 0) {
// ToDo: why should we hide the error code from the file system here?
//status = ERR_VFS_GENERAL;
if (status != 0)
goto err2;
}
} else {
struct vnode* coveredVnode;
status = path_to_vnode(path, true, &coveredVnode, NULL, kernel);
if (status < B_OK)
status = path_to_vnode(path, true, &mount->covers_vnode, NULL, kernel);
if (status != B_OK)
goto err2;
// make sure covered_vnode is a directory
if (!S_ISDIR(coveredVnode->type)) {
if (!S_ISDIR(mount->covers_vnode->type)) {
status = B_NOT_A_DIRECTORY;
goto err2;
goto err3;
}
if (coveredVnode->mount->root_vnode == coveredVnode) {
if (mount->covers_vnode->mount->root_vnode == mount->covers_vnode) {
// this is already a mount point
status = B_BUSY;
goto err2;
goto err3;
}
mount->covers_vnode = coveredVnode;
// mount it/them
fs_volume* volume = mount->volume;
while (volume) {
status = volume->file_system->mount(volume, device, flags, args,
&rootID);
if (status < B_OK) {
if (status != B_OK) {
if (volume->sub_volume)
goto err4;
goto err3;
@ -7116,7 +7110,7 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags,
err4:
FS_MOUNT_CALL_NO_PARAMS(mount, unmount);
err3:
if (mount->covers_vnode)
if (mount->covers_vnode != NULL)
put_vnode(mount->covers_vnode);
err2:
mutex_lock(&sMountMutex);