git: 56da4aa5545f - main - vfs: stop using SAVESTART for rename
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Dec 2022 08:14:41 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=56da4aa5545f9fa968f1d924d01db8939c401c15 commit 56da4aa5545f9fa968f1d924d01db8939c401c15 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-12-14 09:34:53 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2022-12-19 08:09:37 +0000 vfs: stop using SAVESTART for rename ni_startdir has never reached rename routines anyway Reviewed by: mckusick Tested by: pho Differential Revision: https://reviews.freebsd.org/D34468 --- sys/fs/msdosfs/msdosfs_vnops.c | 2 -- sys/kern/vfs_syscalls.c | 16 ++++------------ sys/ufs/ufs/ufs_vnops.c | 2 -- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 8fb58a58b138..9084c1829acc 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1127,8 +1127,6 @@ relock: } if (error != 0) goto unlock; - if ((tcnp->cn_flags & SAVESTART) == 0) - panic("msdosfs_rename: lost to startdir"); } if (tip != NULL) { diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index b3223e620962..fa5888ad836c 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3637,8 +3637,8 @@ kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd, { int error; - NDINIT_ATRIGHTS(fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART | - AUDITVNODE1, pathseg, old, oldfd, &cap_renameat_source_rights); + NDINIT_ATRIGHTS(fromnd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1, + pathseg, old, oldfd, &cap_renameat_source_rights); if ((error = namei(fromnd)) != 0) return (error); error = mac_vnode_check_rename_from(td->td_ucred, fromnd->ni_dvp, @@ -3650,8 +3650,6 @@ kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd, NDFREE_PNBUF(fromnd); vrele(fromnd->ni_dvp); vrele(fromnd->ni_vp); - if (fromnd->ni_startdir) - vrele(fromnd->ni_startdir); } return (error); } @@ -3677,7 +3675,7 @@ again: return (error); } else { #endif - NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | SAVESTART | AUDITVNODE1, + NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | AUDITVNODE1, pathseg, old, oldfd, &cap_renameat_source_rights); if ((error = namei(&fromnd)) != 0) return (error); @@ -3685,7 +3683,7 @@ again: } #endif fvp = fromnd.ni_vp; - tondflags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART | AUDITVNODE2; + tondflags = LOCKPARENT | LOCKLEAF | NOCACHE | AUDITVNODE2; if (fromnd.ni_vp->v_type == VDIR) tondflags |= WILLBEDIR; NDINIT_ATRIGHTS(&tond, RENAME, tondflags, pathseg, new, newfd, @@ -3713,9 +3711,6 @@ again: vput(tdvp); vrele(fromnd.ni_dvp); vrele(fvp); - vrele(tond.ni_startdir); - if (fromnd.ni_startdir != NULL) - vrele(fromnd.ni_startdir); error = vn_start_write(NULL, &mp, V_XSLEEP | V_PCATCH); if (error != 0) return (error); @@ -3775,11 +3770,8 @@ out: vrele(fromnd.ni_dvp); vrele(fvp); } - vrele(tond.ni_startdir); vn_finished_write(mp); out1: - if (fromnd.ni_startdir) - vrele(fromnd.ni_startdir); if (error == ERESTART) return (0); if (error == ERELOOKUP) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 9ea38bc149a5..ecb8cb6900ca 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1510,8 +1510,6 @@ relock: } if (error) goto unlockout; - if ((tcnp->cn_flags & SAVESTART) == 0) - panic("ufs_rename: lost to startdir"); } if (fip->i_effnlink == 0 || fdp->i_effnlink == 0 || tdp->i_effnlink == 0)