if (!(dep_mask & 1))
continue;
/*
- * If this lower level object also needs repair, we can't fix
- * the higher level item.
+ * If this lower level object also needs repair or hasn't been
+ * scanned yet, we can't fix the higher level item.
*/
- if (sri->sri_state[b] & SCRUB_ITEM_NEEDSREPAIR)
+ if (sri->sri_state[b] & (SCRUB_ITEM_NEEDSREPAIR |
+ SCRUB_ITEM_NEEDSCHECK))
return false;
}
if (ret)
return ret;
- return repair_item_class(ctx, sri, -1, SCRUB_ITEM_PREEN, flags);
+ ret = repair_item_class(ctx, sri, -1, SCRUB_ITEM_PREEN, flags);
+ if (ret)
+ return ret;
+
+ return repair_item_class(ctx, sri, -1, SCRUB_ITEM_NEEDSCHECK, flags);
}
/* Create an action item around a scrub item that needs repairs. */
struct action_item *aitem;
unsigned int scrub_type;
- if (repair_item_count_needsrepair(sri) == 0)
+ if (repair_item_count_needswork(sri) == 0)
return 0;
aitem = malloc(sizeof(struct action_item));
if (state[scrub_type] & SCRUB_ITEM_NEEDSCHECK) {
state[scrub_type] &= ~SCRUB_ITEM_NEEDSCHECK;
state[scrub_type] |= SCRUB_ITEM_CORRUPT;
+ aitem->sri.sri_inconsistent = true;
}
}
return nr;
}
+static inline unsigned int
+repair_item_count_needswork(
+ const struct scrub_item *sri)
+{
+ unsigned int scrub_type;
+ unsigned int nr = 0;
+
+ foreach_scrub_type(scrub_type)
+ if (sri->sri_state[scrub_type] & (SCRUB_ITEM_REPAIR_ANY |
+ SCRUB_ITEM_NEEDSCHECK))
+ nr++;
+ return nr;
+}
+
static inline int
repair_item_completely(
struct scrub_ctx *ctx,