Page MenuHomeFreeBSD

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

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



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

Diff Detail

rG FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

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

Also free the vnode cache hashtable

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

Remove unintentionally added line from a different commit

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

I got this with a NON-DIAGNOSTIC build:

20210920 09:54:32 all (4/5):
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 ---

In D31917#722640, @pho wrote:

I got this with a NON-DIAGNOSTIC build:

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().