gofer: Support restore of deleted directories whose original path is occupied.#11843
Merged
copybara-service[bot] merged 1 commit intomasterfrom Jul 16, 2025
Merged
gofer: Support restore of deleted directories whose original path is occupied.#11843copybara-service[bot] merged 1 commit intomasterfrom
copybara-service[bot] merged 1 commit intomasterfrom
Conversation
8783b3e to
8d342f5
Compare
…occupied. It is possible that the application can open an FD to a directory, delete the directory, create another directory at that path and then checkpoint the container. In such a scenario, our gofer restore logic will fail with EEXIST because a directory already exists on the host at that location when we try to recreate it. Use a temporary filename to recreate the directory in such a scenario. This directory is deleted again anyways. This is similar to e3c4c4c ("gofer: Support restore of deleted files whose original path is occupied.") In addition to this, this change also makes the following bug fixes: - Adds a random suffix to the temporary filename used to recreate the file/dir. This helps if multiple (different) deleted open directories exist at the same position. - Change dentry.name for the duration of the restoreDeleted*() function. Note that dentry.restoreFile() use dentry.name to re-open handles and control FD. Hence setting the correct dentry.name is crucial for the handles to point to the correct file. - Added a syscall test, which when run in save/restore mode, tests these code paths for handling open deleted files/directories. Updates #11425 PiperOrigin-RevId: 783627485
8d342f5 to
1282119
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gofer: Support restore of deleted directories whose original path is occupied.
It is possible that the application can open an FD to a directory, delete the
directory, create another directory at that path and then checkpoint the
container. In such a scenario, our gofer restore logic will fail with EEXIST
because a directory already exists on the host at that location when we try to
recreate it.
Use a temporary filename to recreate the directory in such a scenario. This
directory is deleted again anyways.
This is similar to e3c4c4c ("gofer: Support restore of deleted files whose
original path is occupied.")
In addition to this, this change also makes the following bug fixes:
This helps if multiple (different) deleted open directories exist at the same
position.
that dentry.restoreFile() use dentry.name to re-open handles and control FD.
Hence setting the correct dentry.name is crucial for the handles to point to
the correct file.
paths for handling open deleted files/directories.
Updates #11425