mirror of
https://github.com/versity/versitygw.git
synced 2026-09-07 08:36:54 +00:00
A concurrent PutObject and DeleteObject on the same prefix directory can race: PutObject opens an O_TMPFILE in MetaTmpDir (not yet visible in the fs) DeleteObject removes the last visible object in the prefix directory and calls removeParents(), which rmdir's the now-empty prefix directory PutObject's link() tries to link the fd into a parent directory that no longer exists Fix by detecting ENOENT in the final link step (Linkat, Rename, and MoveFile) and retrying after recreating the parent directory. Also extract linkatOTmpfile() to consolidate the Linkat+EEXIST→Renameat logic that was previously inline in link(). Fixes #1988