We now have a consistent scheme what the file system should do with its root

node: like in BeOS, it *must* own the root node (ie. via publish_vnode()),
unlike in BeOS, it must also drop that reference on unmount (symmetrical
behaviour definitely makes more sense to me than the Be way).
Since all existing file systems for Haiku behaved differently, I brought them
in line (only pipefs already adhered to that new standard for some reason,
rootfs did only released the node, devfs did nothing - despite it's probably
not really useful to be able to unmount them).
fs_mount() will now panic if a file system does not do this correctly (useful
for file system developing).
Unmounting is now theoretically working again: when trying to unmount a BFS
volume, the kernel crashes in the block cache destruction... (but that's work
for tomorrow).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14017 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-08-21 00:41:16 +00:00
parent 8c1bec29de
commit 5b14757a30
4 changed files with 46 additions and 38 deletions
+4
View File
@@ -978,6 +978,7 @@ devfs_mount(mount_id id, const char *devfs, uint32 flags, const char *args,
fs->root_vnode = vnode;
hash_insert(fs->vnode_hash, vnode);
publish_vnode(id, vnode->id, vnode);
*root_vnid = vnode->id;
*_fs = fs;
@@ -1006,6 +1007,9 @@ devfs_unmount(fs_volume _fs)
TRACE(("devfs_unmount: entry fs = %p\n", fs));
// release the reference to the root
put_vnode(fs->id, fs->root_vnode->id);
// delete all of the vnodes
hash_open(fs->vnode_hash, &i);
while ((vnode = (devfs_vnode *)hash_next(fs->vnode_hash, &i)) != NULL) {