Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/filemon Don't release the proc_lock mutex until we'r...



details:   https://anonhg.NetBSD.org/src/rev/0763dd86e5ea
branches:  trunk
changeset: 342778:0763dd86e5ea
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Jan 08 08:57:14 2016 +0000

description:
Don't release the proc_lock mutex until we're finished using the stuff
that the mutex protects (ie, the proc list and the entry we found in
the list).

diffstat:

 sys/dev/filemon/filemon.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r afdf8957dd3b -r 0763dd86e5ea sys/dev/filemon/filemon.c
--- a/sys/dev/filemon/filemon.c Fri Jan 08 08:50:07 2016 +0000
+++ b/sys/dev/filemon/filemon.c Fri Jan 08 08:57:14 2016 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: filemon.c,v 1.25 2016/01/08 07:16:13 dholland Exp $ */
+/*      $NetBSD: filemon.c,v 1.26 2016/01/08 08:57:14 pgoyette Exp $ */
 /*
  * Copyright (c) 2010, Juniper Networks, Inc.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.25 2016/01/08 07:16:13 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.26 2016/01/08 08:57:14 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -317,10 +317,10 @@
                /* Set the monitored process ID - if allowed. */
                mutex_enter(proc_lock);
                tp = proc_find(*((pid_t *) data));
-               mutex_exit(proc_lock);
                if (tp == NULL ||
                    tp->p_emul != &emul_netbsd) {
                        error = ESRCH;
+                       mutex_exit(proc_lock);
                        break;
                }
 
@@ -330,6 +330,7 @@
                if (!error) {
                        filemon->fm_pid = tp->p_pid;
                }
+               mutex_exit(proc_lock);
                break;
 
        default:



Home | Main Index | Thread Index | Old Index