Date: Wed, 27 Jan 2016 21:37:43 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294957 - head/sys/dev/filemon Message-ID: <201601272137.u0RLbhRW005004@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601272137.u0RLbhRW005004>