Skip to content

Commit

Permalink
dedupe: Skip extents with insufficient duplicates (#365)
Browse files Browse the repository at this point in the history
Add safety check in push_extents() to prevent queuing work items
with less than 2 duplicates. This prevents assertion failures in
dedupe_extent_list() when the duplicate count drops below 2 between
the initial duplicate detection and worker thread processing.

Fixes: #341
  • Loading branch information
ticpu authored Feb 7, 2025
1 parent e78bbb5 commit e5cfa34
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion run_dedupe.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,16 @@ static int push_extents(struct results_tree *res)
* around the rbtree code here so rb_erase doesn't
* change the tree underneath us.
*/

g_mutex_lock(&mutex);
node = rb_next(node);
g_mutex_unlock(&mutex);

if (dext->de_num_dupes < 2) {
qprintf("Skipping extent - insufficient duplicates (%u)\n",
dext->de_num_dupes);
continue;
}

g_thread_pool_push(dedupe_pool, dext, &err);
if (err) {
eprintf("Fatal error while deduping: %s\n",
Expand Down

0 comments on commit e5cfa34

Please sign in to comment.