From 793782fa2d793bd4a53d8371d1b11e3863a2f336 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 28 Aug 2026 09:17:25 +0200 Subject: [PATCH] Fix premature valid_size update before pwrite completion in parity_write --- cmdline/parity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmdline/parity.c b/cmdline/parity.c index 20243c65..ac2ad08c 100644 --- a/cmdline/parity.c +++ b/cmdline/parity.c @@ -861,10 +861,6 @@ int parity_write(struct snapraid_parity_handle* handle, block_off_t pos, unsigne /* LCOV_EXCL_STOP */ } - /* update the valid range */ - if (split->valid_size < offset + block_size) - split->valid_size = offset + block_size; - bw_limit(handle->bw, block_size); count = 0; @@ -894,6 +890,10 @@ int parity_write(struct snapraid_parity_handle* handle, block_off_t pos, unsigne count += write_ret; } while (count < block_size); + /* update the valid range */ + if (split->valid_size < offset + block_size) + split->valid_size = offset + block_size; + ret = advise_write(&split->advise, split->f, offset, block_size); if (ret != 0) { /* LCOV_EXCL_START */