Don't allow the client to keep using WIP snapshot on Prepare()
failure
#188
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.
#187
Currently, when
Prepare()
fails to prepare a remote snapshot, it falls back tothe normal overlayfs mode even after the remote snapshot is mounted on this
snapshot directory by
FileSystem.Mount()
.Here, we shouldn't keep using this already-mounted snapshot (calls WIP
snapshot here) and we are recently seeing errors related to this. When the
client tries to
Prepare
the sameChainID
's remote snapshot from differentnamespaces, the second
Prepare()
fails oncommit()
withAlreadyExists
error. Currenlty, this returns the WIP snapshot to the client. When the client
tries to unpack the layer on this WIP snapshot (following the normal snapshot
preparation procedure), it fails because the mounted (read-only) snapshot
doesn't allow to write there.
Note that this bug doesn't occur as long as the client uses single namespace
because the
AlreadyExists
error is detected in the metadata snapshotter and noinvocation occurs to stargz snpashotter's
Prepare()
API.This commit fixes this issue by prohibiting the client to use this WIP snapshot
by immediately returning an error on the failure occurring after
FileSystem.Mount()
call.Note that the failure on
FileSystem.Mount()
call itself still falls back tothe overlayfs snapshotter behaviour, which is needed for supporting non-remote
snapshots. This commit also adds a comment for making sure this fallback is
safe.
Signed-off-by: Kohei Tokunaga ktokunaga.mail@gmail.com