Fix regression with both touch and threshold active at the same time

This commit is contained in:
Andrea Mazzoleni 2026-07-19 17:21:51 +02:00
parent f1889de305
commit 3f280486bd
2 changed files with 14 additions and 5 deletions

View file

@ -1,6 +1,14 @@
SnapRAID HISTORY
================
14.9 2026/07
============
* Fix a regression when both the '--gui-touch-before' and
'--gui-threshold' options are selected at the same time, which may
prevent the thresholds from working correctly. Now, the content file
is unconditionally saved before scanning for differences if any touch
is performed.
14.8 2026/06
============
* Avoid spinning up standby disks on Windows in some machines during

View file

@ -1832,20 +1832,21 @@ int snapraid_main(int argc, char* argv[])
if (state.opt.force_realloc)
state_locate_mark_tail_blocks_for_resync(&state, opt.parity_tail);
if (opt.gui_touch_before)
if (opt.gui_touch_before) {
state_touch(&state);
/* save the new state if required */
if (state.need_write)
state_write(&state);
}
state_scan(&state);
if (opt.gui_threshold_removes != 0 && state.removed_files >= opt.gui_threshold_removes) {
if (state.need_write)
state_write(&state);
log_fatal(EUSER, "Too many files were removed (%u, limit is %u). Sync aborted.\n", state.removed_files, opt.gui_threshold_removes);
exit(EXIT_SYNC_NEEDED);
}
if (opt.gui_threshold_updates != 0 && state.updated_files >= opt.gui_threshold_updates) {
if (state.need_write)
state_write(&state);
log_fatal(EUSER, "Too many files were updated (%u, limit is %u). Sync aborted.\n", state.updated_files, opt.gui_threshold_updates);
exit(EXIT_SYNC_NEEDED);
}