UFS sometimes reports: 'ufs_rename: fvp == tvp (can't happen)'. The case
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 15 Aug 2005 07:26:47 +0000 (07:26 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 15 Aug 2005 07:26:47 +0000 (07:26 +0000)
commitbc8fd9e03e7a4ae33b8f15a22ccf4a86788e4779
tree4b7197ff5fb68f9301ee211e7b83baabd6db66e1
parentc3274b0a6eb738757a3d0a3a683bf5cc6e3bffc9
UFS sometimes reports: 'ufs_rename: fvp == tvp (can't happen)'.  The case
is not supposed to be able to happen, and UFS ignores the rename operation
when it sees it.   This is true in both FreeBSD and DragonFly.

But, in fact, the case CAN happen if you rename a file to another that
happens to be a hardlink to the first.  The rename operations appears to
succeed but winds up being a NOP because UFS incorrectly believes that the
case represents renaming a file to itself when it doesn't.  Both files
remain in existance when the source file should have been removed.

Detect the condition and issue VOP_NREMOVE instead of VOP_NRENAME when
the source and target represent different namespaces but wind up pointing
to the same physical vnode.

Reported-by: =?ISO-8859-2?Q?Toma=BE_Bor=B9tnar?= <tomaz.borstnar@amis.net>
sys/kern/vfs_syscalls.c