gofer: Support restore of deleted directories whose original path is occupied. #11843
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