From fe0e833f1f0c05a441cb2da2823b84d8fe6084cb Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 22 Nov 2024 16:57:27 -0500 Subject: [PATCH] fat, exfat: Add acquire_vnode/put_vnode calls in the I/O hooks. Same as was done in BFS. --- src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp | 3 +++ src/add-ons/kernel/file_systems/fat/kernel_interface.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp b/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp index 4b36b4e3bb..cea433b082 100644 --- a/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp @@ -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); } diff --git a/src/add-ons/kernel/file_systems/fat/kernel_interface.cpp b/src/add-ons/kernel/file_systems/fat/kernel_interface.cpp index ab1d7de415..c147ffc22a 100644 --- a/src/add-ons/kernel/file_systems/fat/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/fat/kernel_interface.cpp @@ -1031,6 +1031,7 @@ dosfs_io(fs_volume* volume, fs_vnode* vnode, void* cookie, io_request* request) mount* bsdVolume = reinterpret_cast(volume->private_volume); msdosfsmount* fatVolume = reinterpret_cast(bsdVolume->mnt_data); struct vnode* bsdNode = reinterpret_cast(vnode->private_node); + denode* fatNode = reinterpret_cast(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(cookie); + denode* fatNode = reinterpret_cast(bsdNode->v_data); rw_lock_read_unlock(&bsdNode->v_vnlock->haikuRW); + put_vnode(bsdNode->v_mount->mnt_fsvolume, fatNode->de_inode); return B_OK; }