fat, exfat: Add acquire_vnode/put_vnode calls in the I/O hooks.

Same as was done in BFS.
This commit is contained in:
Augustin Cavalier 2024-11-22 16:57:27 -05:00
parent 9708b08060
commit fe0e833f1f
2 changed files with 8 additions and 0 deletions

View File

@ -71,6 +71,7 @@ iterative_io_finished_hook(void* cookie, io_request* request, status_t status,
{
Inode* inode = (Inode*)cookie;
rw_lock_read_unlock(inode->Lock());
put_vnode(inode->GetVolume()->FSVolume(), inode->ID());
return B_OK;
}
@ -328,6 +329,8 @@ exfat_io(fs_volume* _volume, fs_vnode* _node, void* _cookie,
// We lock the node here and will unlock it in the "finished" hook.
rw_lock_read_lock(inode->Lock());
acquire_vnode(_volume, inode->ID());
return do_iterative_fd_io(volume->Device(), request,
iterative_io_get_vecs_hook, iterative_io_finished_hook, inode);
}

View File

@ -1031,6 +1031,7 @@ dosfs_io(fs_volume* volume, fs_vnode* vnode, void* cookie, io_request* request)
mount* bsdVolume = reinterpret_cast<mount*>(volume->private_volume);
msdosfsmount* fatVolume = reinterpret_cast<msdosfsmount*>(bsdVolume->mnt_data);
struct vnode* bsdNode = reinterpret_cast<struct vnode*>(vnode->private_node);
denode* fatNode = reinterpret_cast<denode*>(bsdNode->v_data);
#ifndef FS_SHELL
if (io_request_is_write(request) && MOUNTED_READ_ONLY(fatVolume) != 0) {
@ -1053,6 +1054,8 @@ dosfs_io(fs_volume* volume, fs_vnode* vnode, void* cookie, io_request* request)
rw_lock_read_lock(&bsdNode->v_vnlock->haikuRW);
acquire_vnode(volume, fatNode->de_inode);
RETURN_ERROR(do_iterative_fd_io(fatVolume->pm_dev->si_fd, request, iterative_io_get_vecs_hook,
iterative_io_finished_hook, bsdNode));
}
@ -3870,8 +3873,10 @@ iterative_io_finished_hook(void* cookie, io_request* request, status_t status, b
size_t bytesTransferred)
{
vnode* bsdNode = reinterpret_cast<vnode*>(cookie);
denode* fatNode = reinterpret_cast<denode*>(bsdNode->v_data);
rw_lock_read_unlock(&bsdNode->v_vnlock->haikuRW);
put_vnode(bsdNode->v_mount->mnt_fsvolume, fatNode->de_inode);
return B_OK;
}