HomeFreeBSD

rename(2): do not allow to rename root vnode of the mounted filesystem

Description

rename(2): do not allow to rename root vnode of the mounted filesystem

Check for tdvp being vp_crossmp. This cannot happen for the normal
rename cases, but could if the target path specified by the syscall
points to the nullfs mount over the regular file. In this case namei()
cannot step over crossmp, and keep it in ni_dvp.

Since crossmp VOP_GETWRITEMOUNT() returns NULL mp, we retry the locking
dance since the belief is that NULL return is transient.

PR: 295826
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57453

Details

Provenance
kibAuthored on Jun 4 2026, 7:56 PM
Reviewer
markj
Differential Revision
D57453: Avoid infinite loop in renameat(2)
Parents
rG5d0ebfe1d978: renameat(2): when retrying, check for pending signals
Branches
Unknown
Tags
Unknown