Rename is the hairiest vop and has the insanest API of them all, and in most of our file systems it's hosed. I'd like to fix that.
A few months ago I asked here for review on a patch to implement a generic abstraction with a saner protocol for implementing rename, and to make several file systems use this. That way, we can eventually make them all use the generic abstraction and replace the current insane VOP_RENAME protocol. But maybe it was too large a patch to review. So I've found a bit of time to update the patch, simplify some of the changes, and split it into a few smaller patches (with apologies to the mailing list archive): http://www.NetBSD.org/~riastradh/patches/rename/genfs_rename.patch implements the generic abstraction, genfs_rename, which handles the hairy common logic of ancestry checks, lock order, permissions, and so on; http://www.NetBSD.org/~riastradh/patches/rename/tmpfs_genfs_rename.patch makes tmpfs use genfs_rename; http://www.NetBSD.org/~riastradh/patches/rename/ufs_genfs_rename.patch makes ffs, lfs, and ext2fs use genfs_rename; and http://www.NetBSD.org/~riastradh/patches/rename/t_renamerace.patch http://www.NetBSD.org/~riastradh/patches/rename/fstest_fix.patch http://www.NetBSD.org/~riastradh/patches/rename/rename_tests.patch all update, fix, and add tests related to rename. With these patches, tmpfs, ffs, lfs, and ext2fs all pass all the tests I've thrown at them. (Previously ext2fs did not, and there was a lot of hairy logic duplicated between tmpfs, ffs, and lfs.) I would like to commit at least the first three (genfs_rename.patch, tmpfs_genfs_rename.patch, and ufs_genfs_rename.patch), but I don't want to do so unless they've been reviewed by someone else. Please take a look and tell me what I've done horribly wrong and how this is going to hose NetBSD forever if I even think about committing any of it.