about summary refs log tree commit diff
path: root/tvix/store/src
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-11-27T18·52+0200
committerflokli <flokli@flokli.de>2023-11-28T14·54+0000
commitfce9c0e99ef219a97bd8ba14cf0eed6c998a1c80 (patch)
treee407a16b4d20103e30dfca012404633e98c8fe97 /tvix/store/src
parent84a846a3a253160178037996bbd4b3e527be7b4f (diff)
fix(tvix/store/fs): don't panic on PathInfoService error r/7080
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 <cbrewster@hey.com>
Diffstat (limited to 'tvix/store/src')
-rw-r--r--tvix/store/src/fs/mod.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/tvix/store/src/fs/mod.rs b/tvix/store/src/fs/mod.rs
index f942cc962257..c1ae6c9c1901 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();