From 719bc5a3d549719744de7973d14e69621c43dd15 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 4 Sep 2026 08:20:04 +0200 Subject: [PATCH] Persist content state after parity handles are closed in scrub --- cmdline/scrub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmdline/scrub.c b/cmdline/scrub.c index 529ba561..745b984d 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -958,10 +958,6 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par end: state_progress_end(state, countpos, countmax, countsize, "Nothing to scrub. Use the -p PLAN option to select a different plan, like -p full.\n"); - /* save the new state if required */ - if (state->need_write || state->opt.force_content_write) - state_write(state); - state_usage_print(state); if (soft_error || silent_error || io_error) { @@ -1241,6 +1237,10 @@ int state_scrub(struct snapraid_state* state, int plan100, int olderthan) } } + /* persist progress and error markings 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;