Skip to content

Commit

Permalink
Merge pull request #795 from imageworks/proxy-copy-fallback
Browse files Browse the repository at this point in the history
Also fallback to copying on too many links for proxy files
  • Loading branch information
rydrman authored Jul 19, 2023
2 parents 9ca9d6e + 34f0a91 commit 1868060
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/spfs/src/storage/fs/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,19 @@ where
std::io::ErrorKind::AlreadyExists => {
RenderBlobResult::PayloadAlreadyExists
}
_ if err.raw_os_error()
== Some(nix::errno::Errno::EMLINK as i32) =>
{
// hard-linking can fail if we have reached the maximum number of links
// for the underlying file system. Often this number is arbitrarily large,
// but on some systems and filers, or at certain scales the possibility is
// very real. In these cases, our only real course of action other than failing
// is to fall back to a real copy of the file.
let _ = self
.render_blob(target_dir_fd, entry, RenderType::Copy)
.await?;
return Ok(RenderBlobResult::PayloadCopiedLinkLimit);
}
_ => {
return Err(Error::StorageWriteError(
"hard_link of payload to proxy path",
Expand Down

0 comments on commit 1868060

Please sign in to comment.