diff options
Diffstat (limited to 'libdiskfs/peropen-rele.c')
-rw-r--r-- | libdiskfs/peropen-rele.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libdiskfs/peropen-rele.c b/libdiskfs/peropen-rele.c index b38b2af6..032f820e 100644 --- a/libdiskfs/peropen-rele.c +++ b/libdiskfs/peropen-rele.c @@ -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,13 +23,20 @@ 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->lock_status != LOCK_UN) + fshelp_acquire_lock (&po->np->userlock, &po->lock_status, + &po->np->lock, LOCK_UN); + diskfs_nput (po->np); + free (po); } |