From: Alexander Zarochentsev Date: Sun, 28 May 2023 12:42:27 +0000 (-0400) Subject: LU-16873 osd: update OI_Scrub file with new magic X-Git-Tag: 2.15.57~144 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F51226%2F2;p=fs%2Flustre-release.git LU-16873 osd: update OI_Scrub file with new magic 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 Change-Id: Ia13fcfaf0d8f2c4ee9331dd9fec0ff159d195186 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51226 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/scrub.c b/lustre/obdclass/scrub.c index daf44e3..944f9e3 100644 --- a/lustre/obdclass/scrub.c +++ b/lustre/obdclass/scrub.c @@ -127,6 +127,7 @@ EXPORT_SYMBOL(scrub_file_init); void scrub_file_reset(struct lustre_scrub *scrub, guid_t uuid, u64 flags) { struct scrub_file *sf = &scrub->os_file; + ENTRY; CDEBUG(D_LFSCK, "%s: reset OI scrub file, old flags = " "%#llx, add flags = %#llx\n", @@ -150,6 +151,7 @@ void scrub_file_reset(struct lustre_scrub *scrub, guid_t uuid, u64 flags) sf->sf_items_igif = 0; if (!scrub->os_in_join) sf->sf_items_updated_prior = 0; + EXIT; } EXPORT_SYMBOL(scrub_file_reset); diff --git a/lustre/osd-ldiskfs/osd_oi.c b/lustre/osd-ldiskfs/osd_oi.c index cc69fe2d..1f001db 100644 --- a/lustre/osd-ldiskfs/osd_oi.c +++ b/lustre/osd-ldiskfs/osd_oi.c @@ -316,7 +316,7 @@ osd_oi_table_open(struct osd_thread_info *info, struct osd_device *osd, if (rc == -ENOENT && create == false) { if (oi_count == 0) - return count; + RETURN(count); rc = 0; ldiskfs_set_bit(i, sf->sf_oi_bitmap); @@ -425,23 +425,20 @@ int osd_oi_init(struct osd_thread_info *info, struct osd_device *osd, 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); - sf->sf_oi_count = osd_oi_count; + count = osd_oi_count; } scrub_file_reset(scrub, osd->od_uuid, SF_RECREATED); - count = sf->sf_oi_count; + sf->sf_oi_count = count; goto create; }