svn commit: r294957 - head/sys/dev/filemon
Bryan Drewery
bdrewery at FreeBSD.org
Wed Jan 27 21:37:45 UTC 2016
Author: bdrewery
Date: Wed Jan 27 21:37:43 2016
New Revision: 294957
URL: https://svnweb.freebsd.org/changeset/base/294957
Log:
filemon_dtr: Lock the associated filemon handle before writing to it.
Reported by: mjg
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Modified:
head/sys/dev/filemon/filemon.c
Modified: head/sys/dev/filemon/filemon.c
==============================================================================
--- head/sys/dev/filemon/filemon.c Wed Jan 27 21:27:05 2016 (r294956)
+++ head/sys/dev/filemon/filemon.c Wed Jan 27 21:37:43 2016 (r294957)
@@ -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)
More information about the svn-src-head
mailing list