Skip to content

Commit ef59c30

Browse files
Johan-Liebert1cgwalters
authored andcommitted
gc: Do not block on GC if we encounter corrupted state
If we find an orphan state directory that has invalid fs-verity, which could've resulted from the user snooping around or one of our operations messing things up, we do not want to block on GC and allow user to switch/upgrade to a new deployment. Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent 9aad3dd commit ef59c30

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • crates/lib/src/bootc_composefs

‎crates/lib/src/bootc_composefs/gc.rs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,13 @@ pub(crate) async fn composefs_gc(
494494
// These won't be GC'd by the above `repo.gc` as the EROFS have
495495
// `/boot` masked
496496
for verity in all_orphans {
497-
let verity_to_sha = Sha512HashValue::from_hex(verity)
498-
.with_context(|| anyhow::anyhow!("Bad fsverity {verity}"))?;
497+
let verity_to_sha = Sha512HashValue::from_hex(verity);
498+
499+
let Ok(verity_to_sha) = verity_to_sha else {
500+
// We do not want to block on GC if we find corrupted state
501+
tracing::warn!("Bad FSVerity '{verity}' when performing GC on orphan, skipping");
502+
continue;
503+
};
499504

500505
let linked_images = linked_erofs_images(&booted_cfs.repo, &verity_to_sha)
501506
.with_context(|| anyhow::anyhow!("Getting linked images for {verity}"))?;

0 commit comments

Comments
 (0)