Lock order reversal ufs, nullfs, devfs

From: Artem Kuchin <artem_at_artem.ru>
Date: Wed, 11 Jan 2023 18:28:03 UTC
Hello

FreeBSD omni.lindar.ru 13.1-STABLE FreeBSD 13.1-STABLE #5 stable/13-n253353-03c82ccba083: Tue Jan 10 16:09:51 MSK 2023artem@omni.lindar.ru:/usr/obj/usr/src/amd64.amd64/sys/OMNI  amd64

Upgraded from 12.1 last week and had stability issues. But hardware also changed, i was looking for things to tweak.
Recompiled kernel with witness and invarinats and now i can see what is below.

Is it safe? Bad or not bad?
Also similar message appear before shutdown but it does not go to logs, so, cannot catch it.


Jan 11 21:00:43 omni kernel: lock order reversal:
Jan 11 21:00:43 omni kernel:  1st 0xfffff8004f1a3628 ufs (ufs, lockmgr) @ /usr/src/sys/kern/vfs_mount.c:1062
Jan 11 21:00:43 omni kernel:  2nd 0xfffff80004067440 devfs (devfs, lockmgr) @ /usr/src/sys/kern/vfs_mount.c:1074
Jan 11 21:00:43 omni kernel: lock order devfs -> ufs established at:
Jan 11 21:00:43 omni kernel: #0 0xffffffff80cab8cd at witness_checkorder+0x32d
Jan 11 21:00:43 omni kernel: #1 0xffffffff80c0ccf2 at lockmgr_lock_flags+0x182
Jan 11 21:00:43 omni kernel: #2 0xffffffff80fa98ac at ffs_lock+0x6c
Jan 11 21:00:43 omni kernel: #3 0xffffffff80d3a174 at _vn_lock+0x54
Jan 11 21:00:43 omni kernel: #4 0xffffffff80d1ccaf at vfs_domount_first+0x58f
Jan 11 21:00:43 omni kernel: #5 0xffffffff80d196b4 at vfs_domount+0x2d4
Jan 11 21:00:43 omni kernel: #6 0xffffffff80d18585 at vfs_donmount+0x895
Jan 11 21:00:43 omni kernel: #7 0xffffffff80d1bcd3 at kernel_mount+0x63
Jan 11 21:00:43 omni kernel: #8 0xffffffff80d1f984 at parse_mount+0x4d4
Jan 11 21:00:43 omni kernel: #9 0xffffffff80d1dfc3 at vfs_mountroot+0x7c3
Jan 11 21:00:43 omni kernel: #10 0xffffffff80bcae03 at start_init+0x23
Jan 11 21:00:43 omni kernel: #11 0xffffffff80bf7f40 at fork_exit+0x80
Jan 11 21:00:43 omni kernel: #12 0xffffffff8110bf2e at fork_trampoline+0xe
Jan 11 21:00:43 omni kernel: lock order ufs -> devfs attempted at:
Jan 11 21:00:43 omni kernel: #0 0xffffffff80cac19d at witness_checkorder+0xbfd
Jan 11 21:00:43 omni kernel: #1 0xffffffff80c0e725 at lockmgr_xlock+0x55
Jan 11 21:00:43 omni kernel: #2 0xffffffff80d3a174 at _vn_lock+0x54
Jan 11 21:00:43 omni kernel: #3 0xffffffff80d1ccaf at vfs_domount_first+0x58f
Jan 11 21:00:43 omni kernel: #4 0xffffffff80d196b4 at vfs_domount+0x2d4
Jan 11 21:00:43 omni kernel: #5 0xffffffff80d18585 at vfs_donmount+0x895
Jan 11 21:00:43 omni kernel: #6 0xffffffff80d17cb9 at sys_nmount+0x69
Jan 11 21:00:43 omni kernel: #7 0xffffffff8113752e at amd64_syscall+0x12e
Jan 11 21:00:43 omni kernel: #8 0xffffffff8110b7cb at fast_syscall_common+0xf8
Jan 11 21:00:48 omni kernel: lock order reversal:
Jan 11 21:00:48 omni kernel:  1st 0xfffff8018b02c440 ufs (ufs, lockmgr) @ /usr/src/sys/kern/vfs_subr.c:3043
Jan 11 21:00:48 omni kernel:  2nd 0xfffff8018b02c258 nullfs (nullfs, lockmgr) @ /usr/src/sys/fs/nullfs/null_vnops.c:913
Jan 11 21:00:48 omni kernel:  3rd 0xfffff80008a3dbe0 ufs (ufs, lockmgr) @ /usr/src/sys/ufs/ufs/ufs_quota.c:1596
Jan 11 21:00:48 omni kernel: lock order ufs -> nullfs established at:
Jan 11 21:00:48 omni kernel: #0 0xffffffff80cab8cd at witness_checkorder+0x32d
Jan 11 21:00:48 omni kernel: #1 0xffffffff80c0d3db at lockmgr_xlock_hard+0x6b
Jan 11 21:00:48 omni kernel: #2 0xffffffff80c0dcd9 at __lockmgr_args+0x1f9
Jan 11 21:00:48 omni kernel: #3 0xffffffff82562b80 at null_reclaim+0x60
Jan 11 21:00:48 omni kernel: #4 0xffffffff81208914 at VOP_RECLAIM_APV+0x34
Jan 11 21:00:48 omni kernel: #5 0xffffffff80d25f84 at vgonel+0x3b4
Jan 11 21:00:48 omni kernel: #6 0xffffffff80d2664e at vrecycle+0x3e
Jan 11 21:00:48 omni kernel: #7 0xffffffff82562ac0 at null_inactive+0x40
Jan 11 21:00:48 omni kernel: #8 0xffffffff80d250bf at vinactivef+0xbf
Jan 11 21:00:48 omni kernel: #9 0xffffffff80d248f7 at vput_final+0x2a7
Jan 11 21:00:48 omni kernel: #10 0xffffffff80d31f05 at kern_funlinkat+0x235
Jan 11 21:00:48 omni kernel: #11 0xffffffff80d31cc8 at sys_unlink+0x28
Jan 11 21:00:48 omni kernel: #12 0xffffffff8113752e at amd64_syscall+0x12e
Jan 11 21:00:48 omni kernel: #13 0xffffffff8110b7cb at fast_syscall_common+0xf8
Jan 11 21:00:48 omni kernel: lock order nullfs -> ufs attempted at:
Jan 11 21:00:48 omni kernel: #0 0xffffffff80cac19d at witness_checkorder+0xbfd
Jan 11 21:00:48 omni kernel: #1 0xffffffff80c0ccf2 at lockmgr_lock_flags+0x182
Jan 11 21:00:48 omni kernel: #2 0xffffffff80fa98ac at ffs_lock+0x6c
Jan 11 21:00:48 omni kernel: #3 0xffffffff80d3a174 at _vn_lock+0x54
Jan 11 21:00:48 omni kernel: #4 0xffffffff80fb630a at dqsync+0x14a
Jan 11 21:00:48 omni kernel: #5 0xffffffff80fb6632 at qsyncvp+0x52
Jan 11 21:00:48 omni kernel: #6 0xffffffff80fb0e2e at ufs_inactive+0x3e
Jan 11 21:00:48 omni kernel: #7 0xffffffff80d250bf at vinactivef+0xbf
Jan 11 21:00:48 omni kernel: #8 0xffffffff80d248f7 at vput_final+0x2a7
Jan 11 21:00:48 omni kernel: #9 0xffffffff82562c16 at null_reclaim+0xf6
Jan 11 21:00:48 omni kernel: #10 0xffffffff81208914 at VOP_RECLAIM_APV+0x34
Jan 11 21:00:48 omni kernel: #11 0xffffffff80d25f84 at vgonel+0x3b4
Jan 11 21:00:48 omni kernel: #12 0xffffffff80d2664e at vrecycle+0x3e
Jan 11 21:00:48 omni kernel: #13 0xffffffff82562ac0 at null_inactive+0x40
Jan 11 21:00:48 omni kernel: #14 0xffffffff80d250bf at vinactivef+0xbf
Jan 11 21:00:48 omni kernel: #15 0xffffffff80d248f7 at vput_final+0x2a7
Jan 11 21:00:48 omni kernel: #16 0xffffffff80d31f05 at kern_funlinkat+0x235
Jan 11 21:00:48 omni kernel: #17 0xffffffff80d31cc8 at sys_unlink+0x28