[haiku-commits] BRANCH HaikuPM-github.package-management - src/add-ons/kernel/file_systems/packagefs

  • From: HaikuPM-github.package-management <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 5 Apr 2013 00:45:34 +0200 (CEST)

added 3 changesets to branch 'refs/remotes/HaikuPM-github/package-management'
old head: ce1d0481833eaa6aa22e1006e92602db3ed33f97
new head: 05940bc51417d34f7cb78bd1f2253d305320c563
overview: https://github.com/haiku/HaikuPM/compare/ce1d048...05940bc

----------------------------------------------------------------------------

dedc136: packagefs: Acquire missing reference for the root dir
  
  We need one for the ID table and one for the volume itself.

c7382d4: packagefs: Acquire missing reference for shine-through dirs
  
  Since we publish shine-through directories directly to the VFS, we need
  to acquire an additional reference, because we release a reference when
  a node is put.

05940bc: 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.

                                    [ Ingo Weinhold <ingo_weinhold@xxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 8 insertions(+), 1 deletion(-)
src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp | 3 +++
src/add-ons/kernel/file_systems/packagefs/Volume.cpp        | 6 +++++-

############################################################################

Commit:      dedc1369e1d745b0a678df432d6131893290cfd2
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Thu Apr  4 22:17:22 2013 UTC

packagefs: Acquire missing reference for the root dir

We need one for the ID table and one for the volume itself.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp 
b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp
index f4be297..e7dd574 100644
--- a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp
@@ -660,6 +660,8 @@ Volume::Mount(const char* parameterString)
                RETURN_ERROR(B_NO_MEMORY);
        fRootDirectory->Init(NULL, volumeName, 0);
        fNodes.Insert(fRootDirectory);
+       fRootDirectory->AcquireReference();
+               // one reference for the table
 
        // get our mount point
        error = vfs_get_mount_point(fFSVolume->id, &fMountPoint.deviceID,

############################################################################

Commit:      c7382d4c9d83304e44e8672caaf71895715efd62
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Thu Apr  4 22:20:32 2013 UTC

packagefs: Acquire missing reference for shine-through dirs

Since we publish shine-through directories directly to the VFS, we need
to acquire an additional reference, because we release a reference when
a node is put.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp 
b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp
index e7dd574..f39acd1 100644
--- a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp
@@ -1805,8 +1805,10 @@ Volume::_PublishShineThroughDirectories()
                }
 
                // publish the vnode, so the VFS will find it without asking us
+               directory->AcquireReference();
                error = PublishVNode(directory);
                if (error != B_OK) {
+                       directory->ReleaseReference();
                        _RemoveNode(directory);
                        RETURN_ERROR(error);
                }

############################################################################

Commit:      05940bc51417d34f7cb78bd1f2253d305320c563
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Thu Apr  4 22:31:51 2013 UTC

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.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp 
b/src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp
index 1abac70..a520416 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 f39acd1..37a08d4 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);
        }
 }


Other related posts: