From 05940bc51417d34f7cb78bd1f2253d305320c563 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 5 Apr 2013 00:31:51 +0200 Subject: [PATCH] packagefs: Fix handling of package-links directory on unmount * Volume::_RemovePackageLinksDirectory(): We don't want to call _RemovePackageLinksNode(). Besides that the ID hash table has already been emptied before and we would thus release a reference to the node erroneously, the method doesn't do anything we want anyway. We don't want any children to be removed, since we have unregistered the volume's packages already (which removes the respective package link directories); the remaining ones are from other volumes and not ours to remove. * PackageFSRoot: Release a reference to the package links directory in the destructor. We create the directory in Init() after all and no one else takes over ownership. --- src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp | 3 +++ src/add-ons/kernel/file_systems/packagefs/Volume.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp b/src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp index 1abac70b50..a5204164ef 100644 --- a/src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp @@ -42,6 +42,9 @@ PackageFSRoot::PackageFSRoot(dev_t deviceID, ino_t nodeID) PackageFSRoot::~PackageFSRoot() { + if (fPackageLinksDirectory != NULL) + fPackageLinksDirectory->ReleaseReference(); + rw_lock_destroy(&fLock); } diff --git a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp index f39acd1b3e..37a08d49b4 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp @@ -1863,7 +1863,7 @@ Volume::_RemovePackageLinksDirectory() if (packageLinksDirectory->Parent() == fRootDirectory) { packageLinksDirectory->SetListener(NULL); - _RemovePackageLinksNode(packageLinksDirectory); + fRootDirectory->RemoveChild(packageLinksDirectory); packageLinksDirectory->SetParent(NULL); } }