From be3957f9390e224b9d508c284a553eb19b220915 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 5 Sep 2026 10:08:00 +0200 Subject: [PATCH] Ensure parity durability barrier in sync when there are no blocks to sync --- cmdline/sync.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmdline/sync.c b/cmdline/sync.c index 54f7503c..9f83e4b5 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -2181,7 +2181,20 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t } } else { msg_status("Nothing to sync.\n"); - sync_durable = 1; + + /* + * Ensure any parity files created or resized prior to this branch + * are physically committed to disk before declaring sync durable. + */ + ret = state_barrier(state, 0, parity_handle, blockmax); + if (ret == -1) { + /* LCOV_EXCL_START */ + ++process_error; + /* continue, as we are already exiting */ + /* LCOV_EXCL_STOP */ + } else { + sync_durable = 1; + } } }