From 1d4383f62034e7ee86f66715215467d0eb7ff36a Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 10 Oct 1996 16:32:06 +0000 Subject: (diskfs_release_peropen): Before freeing PO, release any user lock it's holding. : New include. --- libdiskfs/peropen-rele.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libdiskfs/peropen-rele.c') 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 #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); } -- cgit v1.2.3