Page MenuHomeFreeBSD

vfs: stop using SAVESTART for rename
ClosedPublic

Authored by mjg on Mar 7 2022, 2:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 20 2024, 8:11 AM
Unknown Object (File)
Mar 12 2024, 2:25 AM
Unknown Object (File)
Jan 21 2024, 3:28 PM
Unknown Object (File)
Jan 14 2024, 9:05 AM
Unknown Object (File)
Dec 20 2023, 4:40 AM
Unknown Object (File)
Nov 5 2023, 1:47 AM
Unknown Object (File)
Aug 19 2023, 5:28 PM
Unknown Object (File)
Jul 25 2023, 8:28 AM
Subscribers

Details

Summary

As far as I can say ni_startdir is of no significance for rename. The target buf is used, but that one is covered with SAVENAME.

ufs rename asserts that SAVESTART is passed, but the assert dates back to the original BSD source import and I don't see it to be of any use here. msdosfs had the same assert copy-pasted.

The goal is to eradicate the SAVESTART flag.

This is 2 commits squashed into one review:

commit f32b40a60e76332951e6dabc9977bd7a76e06d48 (HEAD -> kekeacz)
Author: Mateusz Guzik <mjg@FreeBSD.org>
Date:   Mon Mar 7 13:50:45 2022 +0100

    vfs: stop using SAVESTART for rename
    
    ni_startdir has never reached rename routines anyway. Do pass SAVENAME
    instead as the name is used for relookup (if needed).

commit 4b965c66044dfb3a3849db5e5fd5397408c9e244
Author: Mateusz Guzik <mjg@FreeBSD.org>
Date:   Mon Mar 7 16:34:52 2022 +0100

    vfs: make relookup take an additional argument
    
    instead of looking at SAVESTART
    
    This is a step towards removing the flag.
Test Plan

will ask pho

ran several rename tests from stress2, no issues

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mjg requested review of this revision.Mar 7 2022, 2:45 PM
mjg created this revision.
mjg planned changes to this revision.Mar 7 2022, 3:12 PM

hm, ext2 is using relookup which looks at SAVESTART. I may need to extend the patch, but the ufs and msdosfs remarks remain.

mjg edited the summary of this revision. (Show Details)
  • added relookup changes
sys/kern/vfs_lookup.c
1439

relookup would preferably drop this feature altogether -- interested parties can just vref on their own, but that's for later

This change looks reasonable to me.

sys/kern/vfs_lookup.c
1484

This panic should be more descriptive and should have the correct function name.

This revision is now accepted and ready to land.Mar 13 2022, 12:52 AM
sys/kern/vfs_syscalls.c
3680 ↗(On Diff #103590)

Looks like zfs_freebsd_rename() asserts SAVESTART is set, for some reason. Doesn't it need to be patched as well?

sys/kern/vfs_syscalls.c
3680 ↗(On Diff #103590)

it asserts SAVENAME *and/or* SAVESTART, so it wont fire. I'm going to patch it when removing the flag to begin with.

sys/kern/vfs_syscalls.c
3680 ↗(On Diff #103590)

maybe i should note that SAVESTART implies SAVENAME

sys/fs/ext2fs/ext2_vnops.c
913

I'm having trouble understanding this. Without the change, kern_renameat() passes SAVESTART, so tdvp gets ref'ed in relookup(). Where does that ref get released?

sys/kern/vfs_lookup.c
1482

Does this comment still make sense?

sys/kern/vfs_syscalls.c
3680 ↗(On Diff #103590)

Oops, I see.

sys/fs/ext2fs/ext2_vnops.c
913

i did not track all the releaes, i did verify the code de facto expects SAVESTART and counts line up as long as it is "forced"

This revision was automatically updated to reflect the committed changes.