kernel/vfs: Fix missing lock in fs_mount().
At least a read lock of the sVnodeLock must be held when calling lookup_vnode, but we held none at all. This rectifies that problem. This bug appears to have been around for many years, but no-one noticed since ASSERT_READ_LOCKED_RW_LOCK only works with more debug options turned on than the kernel is built with. I discovered this while working on a new version of those additional options.
This commit is contained in:
parent
5e8058566c
commit
f96456d863
@ -7677,15 +7677,16 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags,
|
||||
|
||||
// the root node is supposed to be owned by the file system - it must
|
||||
// exist at this point
|
||||
rw_lock_write_lock(&sVnodeLock);
|
||||
mount->root_vnode = lookup_vnode(mount->id, rootID);
|
||||
if (mount->root_vnode == NULL || mount->root_vnode->ref_count != 1) {
|
||||
panic("fs_mount: file system does not own its root node!\n");
|
||||
status = B_ERROR;
|
||||
rw_lock_write_unlock(&sVnodeLock);
|
||||
goto err4;
|
||||
}
|
||||
|
||||
// set up the links between the root vnode and the vnode it covers
|
||||
rw_lock_write_lock(&sVnodeLock);
|
||||
if (coveredNode != NULL) {
|
||||
if (coveredNode->IsCovered()) {
|
||||
// the vnode is covered now
|
||||
|
Loading…
x
Reference in New Issue
Block a user