HomeFreeBSD

vfs_lookup_cross_mount(): restore previous do...while loop

Description

vfs_lookup_cross_mount(): restore previous do...while loop

When the cross-mount walking logic in vfs_lookup() was factored into
a separate function, the main cross-mount traversal loop was changed
from a do...while loop conditional on the current vnode having
VIRF_MOUNTPOINT set to an unconditional for(;;) loop. For the
unionfs 'crosslock' case in which the vnode may be re-locked, this
meant that continuing the loop upon finding inconsistent
v_mountedhere state would no longer branch to a check that the vnode
is in fact still a mountpoint. This would in turn lead to over-
iteration and, for INVARIANTS builds, a failed assert on the next
iteration.

Fix this by restoring the previous loop behavior.

Reported by: pho
Tested by: pho
Fixes: 80bd5ef0702562c546fa1717e8fe221058974eac

(cherry picked from commit 586fed0b03561558644eccc37f824c7110500182)

Details

Provenance
jahAuthored on Nov 4 2023, 4:56 PM
Parents
rGd0b4efe6d294: vfs_domount_update(): ensure that 'goto end' works
Branches
Unknown
Tags
Unknown