From fce9c0e99ef219a97bd8ba14cf0eed6c998a1c80 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 27 Nov 2023 20:52:24 +0200 Subject: [PATCH] fix(tvix/store/fs): don't panic on PathInfoService error An error in the PathInfoService request can appear in case the underlying request returns an error. We shouldn't panic and bork the fuse mount, but instead return an IO error. Change-Id: I2daeae629e1627d06adcd7b82ddb76c50c602212 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10154 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster --- tvix/store/src/fs/mod.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tvix/store/src/fs/mod.rs b/tvix/store/src/fs/mod.rs index f942cc962..c1ae6c9c1 100644 --- a/tvix/store/src/fs/mod.rs +++ b/tvix/store/src/fs/mod.rs @@ -232,19 +232,17 @@ impl TvixStoreFs { } // We don't have it yet, look it up in [self.path_info_service]. - match self - .tokio_handle - .block_on({ - let path_info_service = self.path_info_service.clone(); - let digest = *store_path.digest(); - async move { path_info_service.get(digest).await } - }) - .unwrap() - { + match self.tokio_handle.block_on({ + let path_info_service = self.path_info_service.clone(); + let digest = *store_path.digest(); + async move { path_info_service.get(digest).await } + }) { + // if there was an error looking up the path_info, propagate up an IO error. + Err(_e) => Err(io::Error::from_raw_os_error(libc::EIO)), // the pathinfo doesn't exist, so the file doesn't exist. - None => Err(io::Error::from_raw_os_error(libc::ENOENT)), + Ok(None) => Err(io::Error::from_raw_os_error(libc::ENOENT)), // The pathinfo does exist - Some(path_info) => { + Ok(Some(path_info)) => { // There must be a root node (ensured by the validation happening inside clients) let root_node = path_info.node.unwrap().node.unwrap();