The fix for LUS-11542 detects the format change correctly
but does not write new oi scrub file magic, so new mount
triggers the "oi files counter reset" again and again.
Fixes:
126275ba83 ("LU-16655 scrub: upgrade scrub_file from 2.12 format")
HPE-bug-id: LUS-11646
Signed-off-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Change-Id: Ia13fcfaf0d8f2c4ee9331dd9fec0ff159d195186
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51226
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
void scrub_file_reset(struct lustre_scrub *scrub, guid_t uuid, u64 flags)
{
struct scrub_file *sf = &scrub->os_file;
void scrub_file_reset(struct lustre_scrub *scrub, guid_t uuid, u64 flags)
{
struct scrub_file *sf = &scrub->os_file;
CDEBUG(D_LFSCK, "%s: reset OI scrub file, old flags = "
"%#llx, add flags = %#llx\n",
CDEBUG(D_LFSCK, "%s: reset OI scrub file, old flags = "
"%#llx, add flags = %#llx\n",
sf->sf_items_igif = 0;
if (!scrub->os_in_join)
sf->sf_items_updated_prior = 0;
sf->sf_items_igif = 0;
if (!scrub->os_in_join)
sf->sf_items_updated_prior = 0;
}
EXPORT_SYMBOL(scrub_file_reset);
}
EXPORT_SYMBOL(scrub_file_reset);
if (rc == -ENOENT && create == false) {
if (oi_count == 0)
if (rc == -ENOENT && create == false) {
if (oi_count == 0)
rc = 0;
ldiskfs_set_bit(i, sf->sf_oi_bitmap);
rc = 0;
ldiskfs_set_bit(i, sf->sf_oi_bitmap);
if (count == sf->sf_oi_count)
GOTO(out, rc = count);
if (count == sf->sf_oi_count)
GOTO(out, rc = count);
- if (sf->sf_oi_count == 0) {
- if (likely((count & (count - 1)) == 0))
- GOTO(out, rc = count);
-
- LCONSOLE_WARN(
- "%s: invalid oi count %d, remove them, then set it to %d\n",
+ /* Trust the counted number of OI files if it is sane */
+ if ((count & (count - 1)) != 0) {
+ LCONSOLE_WARN("%s: invalid oi count %d, remove them, then set it to %d\n",
osd_dev2name(osd), count, osd_oi_count);
osd_oi_table_put(info, oi, count);
rc = osd_remove_ois(info, osd);
if (rc)
GOTO(out, rc);
osd_dev2name(osd), count, osd_oi_count);
osd_oi_table_put(info, oi, count);
rc = osd_remove_ois(info, osd);
if (rc)
GOTO(out, rc);
- sf->sf_oi_count = osd_oi_count;
}
scrub_file_reset(scrub, osd->od_uuid, SF_RECREATED);
}
scrub_file_reset(scrub, osd->od_uuid, SF_RECREATED);
- count = sf->sf_oi_count;
+ sf->sf_oi_count = count;