Files
seaweedfs/weed
99d2116564 mount: a delayed own rename moves the source only while it holds the renamed file (#13495)
* mount: a delayed own rename moves the source only while it holds the renamed file

MovePath refused an own rename event only while the table still knew the
inode the event names. A writer that renames tmp files into place displaces
each file from the target name with the next rename, and the kernel then
forgets it, so the table soon no longer knows its number. A rename event
that arrives that late, as the ones a mount replays after a takeover do,
moved the next tmp file at the old name to the target name whenever no
handle held it, between its close and its own rename. Both names then
resolved to that file, and GNU mv refused the writer's own rename ("are the
same file").

MovePath now refuses whenever the source holds another inode than the one
an own event names. An event about a hard link names none and moves as
before, and so does a peer's rename.

A file the table knows by another number, at a name it kept, is moved by
the local rename when the response arrives (handleRenameResponse passes
0), so its own event finds nothing left to move. That local apply can be
lost if the rename stream breaks after the filer committed. The source then
keeps such a file until the kernel forgets it or looks the name up again.

Tests: a delayed own rename of an earlier file the kernel has forgotten
leaves the next file at its name; it fails before this change. A peer's
rename of a file the table knows by another number still moves it; this
replaces the own-event case, which no longer holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: a delayed own rename leaves a later forgotten file at the source

With -nfsExport the table retains the path of a file the kernel forgot.
A delayed own rename of an earlier file could find the next tmp file
retained at the name, forgotten between its close and its own rename,
and move it: its retained path went to the target and the live file
there lost the name. moveForgotten now refuses the same way MovePath
does when the source maps to another inode than the event names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-12-05 23:14:13 -08:00
..
2026-04-23 10:05:51 -07:00
…