vfs: remove freed vnode references from dirents
This commit is contained in:
parent
82fca21452
commit
05486bbcc8
1 changed files with 7 additions and 0 deletions
7
fs/vfs.c
7
fs/vfs.c
|
|
@ -28,6 +28,13 @@ static void vfs_vnode_dealloc(struct vnode *vnode)
|
||||||
vnode->parent->refcount--;
|
vnode->parent->refcount--;
|
||||||
spinlock_release(&vnode->parent->lock);
|
spinlock_release(&vnode->parent->lock);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < vnode->parent->num_dirents; i++) {
|
||||||
|
if (vnode->parent->dirents[i].vnode == vnode) {
|
||||||
|
vnode->parent->dirents[i].vnode = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (vnode->parent->refcount == 0)
|
if (vnode->parent->refcount == 0)
|
||||||
vfs_vnode_dealloc(vnode->parent);
|
vfs_vnode_dealloc(vnode->parent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue