aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/filemon
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2016-01-27 21:37:43 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-01-27 21:37:43 +0000
commit50c99f32a97246578fc05f69bef518ff68349d68 (patch)
treecb8f7f71e07371207498a93a212a3c444cfeacf5 /sys/dev/filemon
parentabe53f7e917195d01df59f21490c17d6ffd593ee (diff)
Notes
Diffstat (limited to 'sys/dev/filemon')
-rw-r--r--sys/dev/filemon/filemon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/filemon/filemon.c b/sys/dev/filemon/filemon.c
index 909e0cfc2c0a..0ec83465dbed 100644
--- a/sys/dev/filemon/filemon.c
+++ b/sys/dev/filemon/filemon.c
@@ -126,14 +126,16 @@ filemon_dtr(void *data)
struct filemon *filemon = data;
if (filemon != NULL) {
- struct file *fp = filemon->fp;
+ struct file *fp;
- /* Get exclusive write access. */
+ /* Follow same locking order as filemon_pid_check. */
filemon_lock_write();
+ filemon_filemon_lock(filemon);
/* Remove from the in-use list. */
TAILQ_REMOVE(&filemons_inuse, filemon, link);
+ fp = filemon->fp;
filemon->fp = NULL;
filemon->pid = -1;
@@ -141,6 +143,7 @@ filemon_dtr(void *data)
TAILQ_INSERT_TAIL(&filemons_free, filemon, link);
/* Give up write access. */
+ filemon_filemon_unlock(filemon);
filemon_unlock_write();
if (fp != NULL)