Skip to content

Commit

Permalink
DLPX-81523 test_repeated_reboots failed with core.zcachedb (openzfs#477)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
  • Loading branch information
pcd1193182 authored Jun 10, 2022
1 parent 4fb53e7 commit 2a65d44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions cmd/zfs_object_agent/zettacache/src/checkpoint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::Instant;

use anyhow::Result;
use futures::future;
use futures::stream::FuturesOrdered;
use futures::stream::StreamExt;
Expand Down Expand Up @@ -48,7 +49,7 @@ pub struct CheckpointPhys {
}

impl CheckpointPhys {
pub async fn read(block_access: &BlockAccess, extents: &[Extent]) -> Self {
pub async fn read(block_access: &BlockAccess, extents: &[Extent]) -> Result<Self> {
let raw = extents
.iter()
.map(|&extent| block_access.read_raw(extent, DiskIoType::MaintenanceRead))
Expand All @@ -58,9 +59,9 @@ impl CheckpointPhys {
future::ready(vec)
})
.await;
let (this, _): (Self, usize) = block_access.chunk_from_raw(&raw).unwrap();
let (this, _) = block_access.chunk_from_raw(&raw)?;
debug!("got {:#?}", this);
this
Ok(this)
}

pub async fn write(
Expand Down
3 changes: 1 addition & 2 deletions cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,7 @@ impl Inner {
let (mut primary, primary_disk, guid, extra_disks) =
PrimaryPhys::read(&block_access).await.unwrap();

// XXX proper error handling
let mut checkpoint = CheckpointPhys::read(&block_access, &primary.checkpoint).await;
let mut checkpoint = CheckpointPhys::read(&block_access, &primary.checkpoint).await?;
assert_eq!(checkpoint.id, primary.checkpoint_id);

let mut size_changed = false;
Expand Down
2 changes: 1 addition & 1 deletion cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl ZCacheDBHandle {
let block_access = Arc::new(BlockAccess::new(disks, true));

let (primary, primary_disk, guid, _extra_disks) = PrimaryPhys::read(&block_access).await?;
let checkpoint = Arc::new(CheckpointPhys::read(&block_access, &primary.checkpoint).await);
let checkpoint = Arc::new(CheckpointPhys::read(&block_access, &primary.checkpoint).await?);

let mut slab_builder = SlabAllocatorBuilder::new(checkpoint.slab_allocator.clone());
// We should be able to get away without claiming the metadata space,
Expand Down

0 comments on commit 2a65d44

Please sign in to comment.