aboutsummaryrefslogtreecommitdiff
path: root/libdiskfs/peropen-rele.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/peropen-rele.c')
-rw-r--r--libdiskfs/peropen-rele.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libdiskfs/peropen-rele.c b/libdiskfs/peropen-rele.c
index b38b2af6..6974e86a 100644
--- a/libdiskfs/peropen-rele.c
+++ b/libdiskfs/peropen-rele.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1996 Free Software Foundation
+ Copyright (C) 1994, 1996, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -15,6 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include <sys/file.h>
#include "priv.h"
/* Decrement the reference count on a peropen structure. */
@@ -22,14 +23,27 @@ void
diskfs_release_peropen (struct peropen *po)
{
mutex_lock (&po->np->lock);
+
if (--po->refcnt)
{
mutex_unlock (&po->np->lock);
return;
}
- mach_port_deallocate (mach_task_self (), po->dotdotport);
+
+ if (po->root_parent)
+ mach_port_deallocate (mach_task_self (), po->root_parent);
+
+ if (po->shadow_root && po->shadow_root != po->np)
+ diskfs_nrele (po->shadow_root);
+
+ if (po->shadow_root_parent)
+ mach_port_deallocate (mach_task_self (), po->shadow_root_parent);
+
+ if (po->lock_status != LOCK_UN)
+ fshelp_acquire_lock (&po->np->userlock, &po->lock_status,
+ &po->np->lock, LOCK_UN);
+
diskfs_nput (po->np);
+
free (po);
}
-
-