buf_alloc(): lock the buffer with LK_NOWAIT
The buffer must not be accessed by any other thread, it is freshly allocated. As such, LK_NOWAIT should be nop but also it prevents recording the order between the buffer lock and any other locks we might own in the call to getnewbuf(). In particular, if we own FFS snap lock, it should avoid triggering false positive warning. Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34072
This commit is contained in:
parent
531f8cfea0
commit
5875b94c74
@ -1718,7 +1718,7 @@ buf_alloc(struct bufdomain *bd)
|
||||
if (freebufs == bd->bd_lofreebuffers)
|
||||
bufspace_daemon_wakeup(bd);
|
||||
|
||||
error = BUF_LOCK(bp, LK_EXCLUSIVE, NULL);
|
||||
error = BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL);
|
||||
KASSERT(error == 0, ("%s: BUF_LOCK on free buf %p: %d.", __func__, bp,
|
||||
error));
|
||||
(void)error;
|
||||
|
Loading…
Reference in New Issue
Block a user