Page MenuHomeFreeBSD

Several fixes for nullfs and fifofs
ClosedPublic

Authored by kib on Jul 26 2021, 5:11 PM.

Details

Summary

Nullfs: tolerate relocking of the lower vnode. We need to acquire additional hold reference on the lower vnode, otherwise is lower is relocked and upper is reclaimed, the only reference to lower is invalidated and lowervp is potentially dandling pointer.

Nullfs: provide custom bypass methods for several VOPs which take unlocked vnode. Default bypass cannot handle reclamation. Relevant for VOP_ADVLOCK, VOP_RENAME at least.

Nullfs: re-lock dvp in null_lookup() always, not only on success. Lower lookup might have relocked lowerdvp, which makes upper vp loosing its lock.

Nullfs: style fixes

Fifofs: handle race with relocking in open. It is possible that open relocks fifofs vnode after instantiation but before VOP_OPEN() is called. In this case reclaim/fifo_close() would legitimately see NULL v_fifoinfo.

Reported and tested by: pho

Per commit view is avaiable at https://kib.kiev.ua/git/gitweb.cgi?p=deviant3.git;a=shortlog;h=refs/heads/nullfs

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

kib requested review of this revision.Jul 26 2021, 5:11 PM
kib created this revision.
kib edited the summary of this revision. (Show Details)
kib added a reviewer: markj.
sys/fs/nullfs/null_vnops.c
254
339
664

How do we know that tdnn and tnn are not NULL?

kib marked 3 inline comments as done.Jul 27 2021, 2:27 PM
kib added inline comments.
sys/fs/nullfs/null_vnops.c
664

tdvp and (optional) tvp are locked on VOP entry, and we checked that there is no cross-mount rename at the start of the VOP. Since vnodes are locked (and not doomed), their lower vnodes must be alive.

This revision is now accepted and ready to land.Jul 27 2021, 2:51 PM