From 0e24bb020b49f28646d038c0e91872b2d8bda42f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 29 Mar 2015 17:31:28 +0200 Subject: [PATCH] UserlandFS: Fix detection when a file system should be deleted. This was a regression from hrev39870 where a private Referenceable class was replaced with BReferenceable. Referenceable::RemoveReference() returned a boolean to indicate whether the last reference was released while BReferenceable::ReleaseReference() returns the previous reference count. A file system would therefore be deleted when any but the last reference to it would be released (when multiple volumes of that file system were mounted and one of them was unmounted) and leaked otherwise (when only one volume of that file system was mounted and then unmounted). Fixes #11718. --- .../kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp b/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp index 7728fc9137..dbae4c164e 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp +++ b/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp @@ -164,7 +164,7 @@ UserlandFS::_UnregisterFileSystem(const char* name) if (!fileSystemInitializer) return B_BAD_VALUE; - deleteFS = fileSystemInitializer->ReleaseReference(); + deleteFS = fileSystemInitializer->ReleaseReference() == 1; if (deleteFS) fFileSystems->Remove(name); }