Page MenuHomeFreeBSD

unionfs: lock newly-created vnodes before calling insmntque()
ClosedPublic

Authored by jah on Sun, Sep 12, 5:52 AM.

Details

Summary

This fixes an insta-panic when attempting to use unionfs with
DEBUG_VFS_LOCKS.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jah requested review of this revision.Sun, Sep 12, 5:52 AM
This revision is now accepted and ready to land.Sun, Sep 12, 12:22 PM

Also free the vnode cache hashtable

This revision now requires review to proceed.Sun, Sep 19, 10:36 PM

Remove unintentionally added line from a different commit

This revision is now accepted and ready to land.Sun, Sep 19, 10:50 PM

I got this with a NON-DIAGNOSTIC build:

20210920 09:54:32 all (4/5): unionfs4.sh
panic: ufs dir vp 0xfffffe01494f5258 ip 0xfffff80561d75d80 flags 0x3c0e
cpuid = 7
time = 1632124475
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe014165b670
vpanic() at vpanic+0x187/frame 0xfffffe014165b6d0
panic() at panic+0x43/frame 0xfffffe014165b730
ffs_getpages() at ffs_getpages/frame 0xfffffe014165b760
unionfs_unlock() at unionfs_unlock+0xa8/frame 0xfffffe014165b7a0
vput() at vput+0x69/frame 0xfffffe014165b7d0
vop_stdvput_pair() at vop_stdvput_pair+0x17/frame 0xfffffe014165b7f0
vn_open_cred() at vn_open_cred+0x3a4/frame 0xfffffe014165b960
kern_openat() at kern_openat+0x28c/frame 0xfffffe014165bac0
amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe014165bbf0
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe014165bbf0
--- syscall (499, FreeBSD ELF64, sys_openat), rip = 0x8011a8c1a, rsp = 0x7fffffffe1b8, rbp = 0x7fffffffe2a0 ---

https://people.freebsd.org/~pho/stress/log/log0177.txt

In D31917#722640, @pho wrote:

I got this with a NON-DIAGNOSTIC build:
https://people.freebsd.org/~pho/stress/log/log0177.txt

This issue is clearly due to the lack of the proper implementation of VOP_VPUT_PAIR() for unionfs. It should be similar, but more complicated, to nullfs vput_pair().