fix(recovery): clear sealed failed probe range
Verify the exact failed candidate and proof receipts before restoring JD LBAs 105 through 134 to a zero readback state for a hardware-adapter retry.
This commit is contained in:
parent
e52843f4de
commit
3f36cba2de
1 changed files with 26 additions and 6 deletions
|
|
@ -20,15 +20,28 @@ expected_sha=$(awk '/^ proof_sha256:/ {print $2}' \
|
|||
"${recovery_root}/RETURN-RECEIPT.hldp")
|
||||
[[ ${expected_sha} =~ ^[0-9a-f]{64}$ ]]
|
||||
[[ $(sha256sum "${proof}" | awk '{print $1}') == "${expected_sha}" ]]
|
||||
[[ $(dd if=/dev/vda bs=512 skip=134 count=1 status=none | sha256sum |
|
||||
awk '{print $1}') == "${expected_sha}" ]]
|
||||
candidate_sha=$(awk '/^ sha256:/ {print $2; exit}' \
|
||||
"${recovery_root}/PREPARE-RECEIPT.hldp")
|
||||
[[ ${candidate_sha} =~ ^[0-9a-f]{64}$ ]]
|
||||
[[ $(dd if=/dev/vda bs=512 skip=105 count=29 status=none | sha256sum |
|
||||
awk '{print $1}') == "${candidate_sha}" ]]
|
||||
|
||||
dd if=/dev/zero of=/dev/vda bs=512 seek=134 count=1 conv=notrunc,fsync \
|
||||
status=none
|
||||
zero_sha=$(head -c 512 /dev/zero | sha256sum | awk '{print $1}')
|
||||
readback_sha=$(dd if=/dev/vda bs=512 skip=134 count=1 status=none |
|
||||
current_proof_sha=$(dd if=/dev/vda bs=512 skip=134 count=1 status=none |
|
||||
sha256sum | awk '{print $1}')
|
||||
[[ ${readback_sha} == "${zero_sha}" ]]
|
||||
zero_sector_sha=$(head -c 512 /dev/zero | sha256sum | awk '{print $1}')
|
||||
if [[ ${current_proof_sha} != "${expected_sha}" ]]; then
|
||||
grep -q "^ sealed_sha256: ${expected_sha}$" \
|
||||
"${recovery_root}/PROOF-CLEAR-RECEIPT.hldp"
|
||||
[[ ${current_proof_sha} == "${zero_sector_sha}" ]]
|
||||
fi
|
||||
|
||||
dd if=/dev/zero of=/dev/vda bs=512 seek=105 count=30 conv=notrunc,fsync \
|
||||
status=none
|
||||
zero_range_sha=$(head -c $((30 * 512)) /dev/zero | sha256sum |
|
||||
awk '{print $1}')
|
||||
readback_sha=$(dd if=/dev/vda bs=512 skip=105 count=30 status=none |
|
||||
sha256sum | awk '{print $1}')
|
||||
[[ ${readback_sha} == "${zero_range_sha}" ]]
|
||||
|
||||
observed_at=$(date --iso-8601=seconds)
|
||||
cat >"${recovery_root}/PROOF-CLEAR-RECEIPT.hldp" <<EOF
|
||||
|
|
@ -40,6 +53,13 @@ node_id: JD-FD-PRIMARY
|
|||
proof:
|
||||
lba: 134
|
||||
sealed_sha256: ${expected_sha}
|
||||
candidate:
|
||||
lba_start: 105
|
||||
sector_count: 29
|
||||
sealed_sha256: ${candidate_sha}
|
||||
cleared_range:
|
||||
lba_start: 105
|
||||
sector_count: 30
|
||||
zero_readback_sha256: ${readback_sha}
|
||||
reason: SEALED_FAIL_0_CONSUMED_BEFORE_EXACT_HARDWARE_ADAPTER_RETRY
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Reference in a new issue