mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 04:17:02 -05:00
Persist content state and bad block markings on sync errors while preserving deallocation state
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
This commit is contained in:
parent
0b64fb2eae
commit
fe5ff734f7
1 changed files with 20 additions and 9 deletions
|
|
@ -2155,21 +2155,32 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On close errors, abort without committing or persisting state,
|
* Only a clean full sync makes all deallocation records obsolete.
|
||||||
* keeping the previous content file intact for recovery on the next run.
|
*
|
||||||
|
* When process_error == 0, parity has been fully updated without the deleted
|
||||||
|
* files, so state_commit() clears the dealloclist.
|
||||||
|
*
|
||||||
|
* If any error occurred, state_commit() is skipped so the dealloclist remains
|
||||||
|
* intact. Calling state_write() below will then persist both the accumulated
|
||||||
|
* deallocation records and any error markings to the content file, keeping
|
||||||
|
* recovery data available across consecutive interrupted or failed runs.
|
||||||
*/
|
*/
|
||||||
if (process_error != 0)
|
if (process_error == 0) {
|
||||||
return -1;
|
msg_status("Everything OK\n");
|
||||||
|
|
||||||
msg_status("Everything OK\n");
|
state_commit(state);
|
||||||
|
}
|
||||||
|
|
||||||
/* only a clean full sync makes all deallocation records obsolete */
|
/*
|
||||||
state_commit(state);
|
* Persist progress, error markings, and pending deallocations only after
|
||||||
|
* all parity handles are closed.
|
||||||
/* persist progress and error markings only after all parity handles are closed */
|
*/
|
||||||
if (state->need_write || state->opt.force_content_write)
|
if (state->need_write || state->opt.force_content_write)
|
||||||
state_write(state);
|
state_write(state);
|
||||||
|
|
||||||
|
if (process_error != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue