ramfs: Acquire write lock before unmounting.
Might help with #18032.
(cherry picked from commit 05fdda96b74e0626aac9810298ff9b32500fc64b)
Change-Id: I8be5c88d3749d19984de5458973c88a0f47afb71
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5845
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Diff
src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -118,13 +118,14 @@
{
FUNCTION_START();
Volume* volume = (Volume*)_volume->private_volume;
status_t error = volume->Unmount();
if (error == B_OK)
delete volume;
if (error != B_OK)
REPORT_ERROR(error);
return error;
status_t error = B_OK;
if (VolumeWriteLocker locker = volume) {
error = volume->Unmount();
if (error == B_OK)
delete volume;
} else
SET_ERROR(error, B_ERROR);
RETURN_ERROR(error);
}