cvs commit: src/sys/kern vfs_syscalls.c
Joerg Sonnenberger
joerg at britannica.bec.de
Mon Aug 15 09:02:52 PDT 2005
On Mon, Aug 15, 2005 at 08:17:30AM -0700, Matthew Dillon wrote:
> Rename is a namespace operation.
Rename is *not* a pure namespace operation. When the new argument
already exists, rename can be considered to consist of a delete and a
rename. The problem here is that when old and new resolve to the same
file (read: reference the same inode) strange race conditions can occur
which might led to the reference counter reaching 0 for example.
That is exactly the behaviour the standard wants to avoid. The wording
of SUS is also pretty clear, "resolve to the same existing name" does
mean nothing less than having the same inode for a traditional Unix
filesystem. I also won't say this behaviour is counter-intuitive, it
makes as much sense as just dropping the old node.
I don't buy the argument of nothing relaying on it either, since it
makes correctly renaming files across directories more likely to data
loss as soon as two processes try to do the same with a "delete target
and copy" fall back.
Joerg
More information about the Commits
mailing list