From 0c239554546152bf4b95ff4b9c7cc2bb78dc4306 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 17 Mar 2026 12:28:11 -0700 Subject: [PATCH] Update seq when merging deltas from partial log merge. Two different clients can write delta's for totl indexes at the same time, recording their changes. When merged, a reader should apply both in order, and only once. To do so, the seq determines whether the delta has been applied already. The code fails to update the seq while walking the trees for deltas to apply. Subsequently, when processing subsequent trees, it could re-process deltas already applied. In case of a large negative delta (e.g. removal of large amounts of files), the totl value could become negative, resulting in quota lockout. The fix is simple: advance the seq when reading partial delta merges to avoid double counting. Signed-off-by: Auke Kok --- kmod/src/btree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kmod/src/btree.c b/kmod/src/btree.c index c7365754..f4b6b77a 100644 --- a/kmod/src/btree.c +++ b/kmod/src/btree.c @@ -2183,6 +2183,8 @@ static int merge_read_item(struct super_block *sb, struct scoutfs_key *key, u64 if (ret > 0) { if (ret == SCOUTFS_DELTA_COMBINED) { scoutfs_inc_counter(sb, btree_merge_delta_combined); + if (seq > found->seq) + found->seq = seq; } else if (ret == SCOUTFS_DELTA_COMBINED_NULL) { scoutfs_inc_counter(sb, btree_merge_delta_null); free_mitem(rng, found);