Despite the buffer taken from cache or free list, it still can be
locked, due to 'lockless lookup' in getblkx() potentially operating on
the freed buffers. The lock is transient, but prevents the use of
LK_NOWAIT there for the goal of neutralizing WITNESS.
Just use LK_NOWITNESS.
Reported and tested by: pho
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
(cherry picked from commit
1fb00c8f1060e18fed621f13d31db7b336d2267e)
(cherry picked from commit
dd54e44a279fab567374d2eec9dd9cd6d04b7a43)
if (freebufs == bd->bd_lofreebuffers)
bufspace_daemon_wakeup(bd);
- error = BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL);
+ error = BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
KASSERT(error == 0, ("%s: BUF_LOCK on free buf %p: %d.", __func__, bp,
error));
(void)error;