ramfs: Acquire write lock before unmounting.

Might help with #18032.
This commit is contained in:
Augustin Cavalier 2022-11-29 19:06:56 -05:00
parent d5c130a3f9
commit 05fdda96b7

View File

@ -119,13 +119,14 @@ ramfs_unmount(fs_volume* _volume)
{
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);
}