mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04: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,
|
||||
* keeping the previous content file intact for recovery on the next run.
|
||||
* Only a clean full sync makes all deallocation records obsolete.
|
||||
*
|
||||
* 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)
|
||||
return -1;
|
||||
if (process_error == 0) {
|
||||
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 and error markings only after all parity handles are closed */
|
||||
/*
|
||||
* Persist progress, error markings, and pending deallocations only after
|
||||
* all parity handles are closed.
|
||||
*/
|
||||
if (state->need_write || state->opt.force_content_write)
|
||||
state_write(state);
|
||||
|
||||
if (process_error != 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue