]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC 324039: Don't defer wakeup()s for completed journal workitems.
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 13 Oct 2017 22:40:57 +0000 (22:40 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 13 Oct 2017 22:40:57 +0000 (22:40 +0000)
commitd23b8e7e68136e12dbffe1538e744b11b5b71355
tree23fa133eeef79c94a85c359cd974147e490fbec8
parent72f4b348eae09e218059d3fe378399c41d6f9152
MFC 324039: Don't defer wakeup()s for completed journal workitems.

Normally wakeups() are performed for completed softupdates work items
in workitem_free() before the underlying memory is free()'d.
complete_jseg() was clearing the "wakeup needed" flag in work items to
defer the wakeup until the end of each loop iteration.  However, this
resulted in the item being free'd before it's address was used with
wakeup().  As a result, another part of the kernel could allocate this
memory from malloc() and use it as a wait channel for a different
"event" with a different lock.  This triggered an assertion failure
when the lock passed to sleepq_add() did not match the existing lock
associated with the sleep queue.  Fix this by removing the code to
defer the wakeup in complete_jseg() allowing the wakeup to occur
slightly earlier in workitem_free() before free() is called.

git-svn-id: svn://svn.freebsd.org/base/stable/10@324612 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/ufs/ffs/ffs_softdep.c