From c2f706d7e3143cbe2b57a0f3cf98e6ddcaefe32c Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 19 Jan 1996 00:25:31 +0000 Subject: (trivfs_clean_protid): Don't hold CRED->po->cntl->lock while calling TRIVFS_PEROPEN_DESTROY_HOOK. --- libtrivfs/protid-clean.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libtrivfs/protid-clean.c b/libtrivfs/protid-clean.c index 42879c9e..b986fca0 100644 --- a/libtrivfs/protid-clean.c +++ b/libtrivfs/protid-clean.c @@ -29,11 +29,16 @@ trivfs_clean_protid (void *arg) wasn't initialized to the point of needing user cleanup. */ (*trivfs_protid_destroy_hook) (cred); + /* If we hold the only reference to the peropen, try to get rid of it. */ mutex_lock (&cred->po->cntl->lock); - if (!--cred->po->refcnt) + if (cred->po->refcnt == 1 && trivfs_peropen_destroy_hook) + { + mutex_unlock (&cred->po->cntl->lock); + (*trivfs_peropen_destroy_hook) (cred->po); + mutex_lock (&cred->po->cntl->lock); + } + if (--cred->po->refcnt == 0) { - if (trivfs_peropen_destroy_hook) - (*trivfs_peropen_destroy_hook) (cred->po); ports_port_deref (cred->po->cntl); free (cred->po); } -- cgit v1.2.3