diff --git a/check/main.c b/check/main.c index 81b6650f..96baa0a0 100644 --- a/check/main.c +++ b/check/main.c @@ -7928,6 +7928,8 @@ static int record_unaligned_extent_rec(struct extent_record *rec) rbtree_postorder_for_each_entry_safe(back, tmp, &rec->backref_tree, node) { + bool skip = false; + if (back->full_backref || !back->is_data) continue; @@ -7943,6 +7945,23 @@ static int record_unaligned_extent_rec(struct extent_record *rec) if (IS_ERR_OR_NULL(dest_root)) continue; + /* + * If we repaired something and restarted we could potentially + * try to add this unaligned record multiple times, so check + * before we add a new one. + */ + list_for_each_entry(urec, &dest_root->unaligned_extent_recs, list) { + if (urec->objectid == dest_root->objectid && + urec->owner == dback->owner && + urec->bytenr == rec->start) { + skip = true; + break; + } + } + + if (skip) + continue; + urec = malloc(sizeof(struct unaligned_extent_rec_t)); if (!urec) return -ENOMEM;