diff options
author | Miles Bader <miles@gnu.org> | 1996-10-10 16:32:06 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-10-10 16:32:06 +0000 |
commit | 1d4383f62034e7ee86f66715215467d0eb7ff36a (patch) | |
tree | 93ea259a83906a0f2c9ff8f9eafcdc23a81e2c66 /libdiskfs/peropen-rele.c | |
parent | de57eb2620bb8f1a4ea3dd452e5017410e9c6b54 (diff) |
(diskfs_release_peropen):
Before freeing PO, release any user lock it's holding.
<sys/file.h>:
New include.
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); } |