mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-09 08:33:28 +02:00
Kernel/VirtualFileSystem: Count bind mounts towards normal FS mountcount
This is correct since unmount doesn't treat bind mounts specially. If we don't do this, unmounting bind mounts will call prepare_for_last_unmount() on the guest FS much too early, which will most likely fail due to a busy file system.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
251b17085b
commit
abc1eaff36
Notes:
sideshowbarker
2024-07-17 20:33:50 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/abc1eaff36 Pull-request: https://github.com/SerenityOS/serenity/pull/19668 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/linusg
@@ -217,6 +217,9 @@ ErrorOr<void> VirtualFileSystem::bind_mount(Custody& source, Custody& mount_poin
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
// A bind mount also counts as a normal mount from the perspective of unmount(),
|
||||
// so we need to keep track of it in order for prepare_to_clear_last_mount() to work properly.
|
||||
new_mount->guest_fs().mounted_count({}).with([&](auto& count) { count++; });
|
||||
// NOTE: Leak the mount pointer so it can be added to the mount list, but it won't be
|
||||
// deleted after being added.
|
||||
mounts.append(*new_mount.leak_ptr());
|
||||
|
||||
Reference in New Issue
Block a user