1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00
freebsd/sys/dev/filemon
Bryan Drewery 8183f2e312 Fix filemon locking races.
Convert filemon_lock and struct filemon* lock to sx(9), rather than a
self-rolled reader-writer lock, and hold it for the entire time needed.

At least filemon_lock_write() was not checking for active readers when
it would successfully return with the write lock "held".  This led to
a race with reading entries from filemon_inuse as they were removed.  This
could be seen with QUEUE_MACRO_DEBUG enabled, causing -1 to be read as an
entry rather than a valid struct filemon*.

Fixing filemon_lock_write() to check readers was insufficient to fix the
races.

sx(9) was used as the lock could be held while taking proctree_lock and sleeping
in fo_write.

Sponsored by:	EMC / Isilon Storage Division
MFC after:	2 weeks
2015-08-26 03:44:48 +00:00
..
filemon_lock.c Fix filemon locking races. 2015-08-26 03:44:48 +00:00
filemon_wrapper.c Avoid taking proctree_lock and searching parents in wrappers if not needed. 2015-08-26 03:37:18 +00:00
filemon.c Fix filemon locking races. 2015-08-26 03:44:48 +00:00
filemon.h