store_acquire_unreferenced_ref() saves the pointer of the vnode it got
from the call to vfs_get_vnode() now. Only this way it is safe to call store_release_ref() later (as the page writer does). We had a potential race condition -- if called after vm_cache_remove_consumer() had released the last reference, the old vnode might already have been deleted. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24386 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
23234fa59d
commit
2b0b4bee36
9
src/system/kernel/cache/vnode_store.cpp
vendored
9
src/system/kernel/cache/vnode_store.cpp
vendored
@ -88,7 +88,14 @@ store_acquire_unreferenced_ref(struct vm_store *_store)
|
|||||||
{
|
{
|
||||||
vnode_store *store = (vnode_store *)_store;
|
vnode_store *store = (vnode_store *)_store;
|
||||||
struct vnode *vnode;
|
struct vnode *vnode;
|
||||||
return vfs_get_vnode(store->device, store->inode, false, &vnode);
|
status_t status = vfs_get_vnode(store->device, store->inode, false, &vnode);
|
||||||
|
|
||||||
|
// If successful, update the store's vnode pointer, so that release_ref()
|
||||||
|
// won't use a stale pointer.
|
||||||
|
if (status == B_OK)
|
||||||
|
store->vnode = vnode;
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user