pbuf_ctor(): lock the buffer with LK_NOWAIT
This LOR happens when reading from a file backed MD device: lock order reversal: 1st 0xfffffe00431eaac0 pbufwait (pbufwait, lockmgr) @ /cobra/src/sys/vm/vm_pager.c:471 2nd 0xfffff80003f17930 ufs (ufs, lockmgr) @ /cobra/src/sys/dev/md/md.c:977 lock order pbufwait -> ufs attempted at: #0 0xffffffff80c78ead at witness_checkorder+0xbdd #1 0xffffffff80bd6a52 at lockmgr_lock_flags+0x182 #2 0xffffffff80f52d5c at ffs_lock+0x6c #3 0xffffffff80d0f3f4 at _vn_lock+0x54 #4 0xffffffff80708629 at mdstart_vnode+0x499 #5 0xffffffff807060ec at md_kthread+0x20c #6 0xffffffff80bbfcd0 at fork_exit+0x80 #7 0xffffffff810b809e at fork_trampoline+0xe This LOR was previously blessed by witness before commit531f8cfea0
("Use dedicated lock name for pbufs"). Instead of blessing ufs and pbufwait, use LK_NOWAIT to prevent recording the lock order. LK_NOWAIT will be a nop here as the lock is dropped in pbuf_dtor(). The takes the same approach as5875b94c74
("buf_alloc(): lock the buffer with LK_NOWAIT"). Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D34183
This commit is contained in:
parent
379797d4b4
commit
c9e023541a
@ -467,7 +467,7 @@ pbuf_ctor(void *mem, int size, void *arg, int flags)
|
||||
bp->b_ioflags = 0;
|
||||
bp->b_iodone = NULL;
|
||||
bp->b_error = 0;
|
||||
BUF_LOCK(bp, LK_EXCLUSIVE, NULL);
|
||||
BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user