Whamcloud - gitweb
LU-17280 scrub: skip dir stripes with OI 78/53078/2
authorAlexander Boyko <alexander.boyko@hpe.com>
Wed, 8 Nov 2023 10:32:55 +0000 (05:32 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 Nov 2023 21:37:50 +0000 (21:37 +0000)
After fresh mount and LFSCK start all directory stripes
are added to inconsistent list. So scrub for all stripes
would print LFSCK message "inconsistent OI FID...fixed.
Lets check FID to OI mapping before adding to inconsistent
list.

Also fixing additional debug for scrub.

HPE-bug-id: LUS-11777
Signed-off-by: Alexander Boyko <alexander.boyko@hpe.com>
Change-Id: I869f1cf71eb6c10f386a3f388a38032c73d2b41a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53078
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lfsck/lfsck_namespace.c
lustre/lfsck/lfsck_striped_dir.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_scrub.c

index 6aef951..82eff71 100644 (file)
@@ -577,7 +577,8 @@ log:
        if (th != NULL && !IS_ERR(th))
                dt_trans_stop(env, dev, th);
 
-       CDEBUG(D_LFSCK, "%s: namespace LFSCK %s flags for "DFID" in the "
+       CDEBUG(rc ? D_LFSCK : D_INFO,
+              "%s: namespace LFSCK %s flags for "DFID" in the "
               "trace file, flags %x, old %x, new %x: rc = %d\n",
               lfsck_lfsck2name(lfsck), add ? "add" : "del", PFID(fid),
               (__u32)flags, (__u32)old, (__u32)new, rc);
index eae958d..6cc6034 100644 (file)
@@ -495,7 +495,7 @@ static int lfsck_record_lmv(const struct lu_env *env,
        int                         rc    = 0;
        ENTRY;
 
-       CDEBUG(D_LFSCK, "%s: record slave LMV EA for the striped directory "
+       CDEBUG(D_INFO, "%s: record slave LMV EA for the striped directory "
               DFID": shard = "DFID", index = %u, flags = %u, flags2 = %u, "
               "depth = %d\n", lfsck_lfsck2name(lfsck),
               PFID(lfsck_dto2fid(dir)), PFID(fid),
index e42fff1..6850059 100644 (file)
@@ -951,6 +951,7 @@ static int osd_stripe_dir_filldir(void *buf,
        struct osd_thread_info *oti = oclb->oclb_info;
        struct lu_fid *fid = &oti->oti_fid3;
        struct osd_inode_id *id = &oti->oti_id3;
+       struct osd_inode_id id2;
        struct osd_device *dev = oclb->oclb_dev;
        struct inode *inode;
 
@@ -974,7 +975,9 @@ static int osd_stripe_dir_filldir(void *buf,
 
        iput(inode);
        osd_add_oi_cache(oti, dev, id, fid);
-       osd_scrub_oi_insert(dev, fid, id, true);
+       /* Check shard by scrub only if it has a problem with OI */
+       if (osd_oi_lookup(oti, dev, fid, &id2, 0) || !osd_id_eq(id, &id2))
+               osd_scrub_oi_insert(dev, fid, id, true);
        oclb->oclb_found = true;
 
        return 1;
index f99798c..9501da1 100644 (file)
@@ -208,10 +208,10 @@ int osd_scrub_refresh_mapping(struct osd_thread_info *info,
                                osd_dto_credits_noquota[DTO_INDEX_INSERT]);
        if (IS_ERR(th)) {
                rc = PTR_ERR(th);
-               CDEBUG(D_LFSCK, "%s: fail to start trans for scrub op %d "
-                      DFID" => %u/%u: rc = %d\n", osd_name(dev), ops,
-                      PFID(fid), id ? id->oii_ino : -1, id ? id->oii_gen : -1,
-                      rc);
+               CWARN("%s: fail to start trans for scrub op %d "
+                     DFID" => %u/%u: rc = %d\n", osd_name(dev), ops,
+                     PFID(fid), id ? id->oii_ino : -1, id ? id->oii_gen : -1,
+                     rc);
                RETURN(rc);
        }
 
@@ -1235,9 +1235,10 @@ static int osd_scrub_main(void *args)
                scrub->os_pos_current = ooc->ooc_pos_preload;
        }
 
-       CDEBUG(D_LFSCK, "%s: OI scrub start, flags = 0x%x, pos = %llu\n",
+       CDEBUG(D_LFSCK, "%s: OI scrub start, flags = 0x%x, pos = %llu%s\n",
               osd_scrub2name(scrub), scrub->os_start_flags,
-              scrub->os_pos_current);
+              scrub->os_pos_current,
+              scrub->os_file.sf_param & SP_DRYRUN ? " dryrun mode" : "");
 
        rc = osd_inode_iteration(osd_oti_get(&env), dev, ~0U, false);
        if (unlikely(rc == SCRUB_IT_CRASH)) {
@@ -1261,8 +1262,10 @@ post:
                dev->od_check_ff = 0;
        }
        rc = scrub_thread_post(&env, &dev->od_scrub.os_scrub, rc);
-       CDEBUG(D_LFSCK, "%s: OI scrub: stop, pos = %llu: rc = %d\n",
-              osd_scrub2name(scrub), scrub->os_pos_current, rc);
+       CDEBUG(D_LFSCK, "%s: OI scrub: stop, pos = %llu: rc = %d%s\n",
+              osd_scrub2name(scrub), scrub->os_pos_current, rc,
+              scrub->os_file.sf_param & SP_DRYRUN ? " dryrun mode" : "");
+
 
 out:
        osd_scrub_ois_fini(scrub, &scrub->os_inconsistent_items);