On Sun Feb 23 19:54:25 2025 +0000, Gabriel Ivăncescu wrote:
Sorry it took a bit, I only had some time to look through it again today. I made a combination of your method and mine. I basically put everything into the new function instead of just checking the dentry, because we need to act based on what was found anyway. I also used relative paths (*at functions) to make it simpler and reduce the race conditions, keeping the dir fd open. Obviously it's impossible to be atomic, but I tried to make it have as few syscalls as possible. There's still one problem: hardlinks don't work on directories, so I think for dirs we need something else. I mean the whole "rename temporary then hardlink into dest" thing. For files I tested and it works fine.
Oh yeah I also strip trailing slashes from the destination now, since they're pointless anyway (no need to do it on source).