Page MenuHomeFreeBSD

Some fixes for msdosfs_rename and ufs_rename

Authored by kib on Aug 8 2021, 7:45 PM.



msdosfs_rename: Use the same locking algorithm for msdosfs_rename() as used by ufs_rename(). Convert doscheckpath() to non-sleeping version.

PR: 257522

msdosfs_rename: add a lock to ensure stability of the path check (ufs_checkpath and doscheckpath).

vfs_hash_insert: ensure that predicate is true

After vnode lock, recheck v_hash. When vfs_hash_insert() is used with a predicate, recheck it after the selected vnode is locked. Since vfs_hash_lock is dropped, vnode could be rehashed during the sleep for the vnode lock, which could go unnoticed there.

[The addition of the excl lock assert into vfs_hash_rehash()] is not going to be committed right now]

Tested by: pho

Per-commit view is available at;a=shortlog;h=refs/heads/msdosfs_rename

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Aug 8 2021, 7:45 PM
kib created this revision.

ufs fix was committed
Upload rebased patch, with the accumulated bug fixes.

kib edited the summary of this revision. (Show Details)
kib edited the test plan for this revision. (Show Details)
kib added reviewers: trasz, markj, mckusick, chs.
kib removed a subscriber: trasz.

Upload patch which passed pho run.

This looks like a correct adaptation of the UFS code to the MSDOS filesystem implementation. Given that I have been struggling with getting UFS rename correct since the mid-1980s I am sure there are still bugs lurking in this implementation, but at least they are closer to being the same bugs in both filesystem implementations.

This revision is now accepted and ready to land.Aug 20 2021, 1:00 AM

Fix problems with corrupted lookup cached data in directory vnodes. Basically, add non-sleeping calls to msdosfs_lookup_ino() into several places in msdosfs_rename() to refresh de offsets.

This revision now requires review to proceed.Aug 25 2021, 9:35 PM