Whamcloud - gitweb
LU-4972 lfsck: skip .lustre and children for namespace check 43/10143/3
authorFan Yong <fan.yong@intel.com>
Sat, 5 Apr 2014 02:28:00 +0000 (10:28 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 9 May 2014 14:33:50 +0000 (14:33 +0000)
The sub-directories/files under .lustre are either for partial
repaired objects (such as .lustre/lost+found/) or for special
non-real objects (such as .lustre/obf). It is unnecessary to
do namespace LFSCK for them.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I39e8382c226b2ee19a41e6f47af38a5367f3bdd8
Reviewed-on: http://review.whamcloud.com/10143
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
lustre/include/lustre_fid.h
lustre/lfsck/lfsck_lib.c
lustre/lfsck/lfsck_namespace.c

index 79e956f..769dee5 100644 (file)
@@ -260,6 +260,11 @@ static inline int fid_is_root(const struct lu_fid *fid)
                         fid_oid(fid) == 1));
 }
 
+static inline int fid_seq_is_dot_lustre(__u64 seq)
+{
+       return unlikely(seq == FID_SEQ_DOT_LUSTRE);
+}
+
 static inline int fid_is_dot_lustre(const struct lu_fid *fid)
 {
        return unlikely(fid_seq(fid) == FID_SEQ_DOT_LUSTRE &&
@@ -304,7 +309,7 @@ static inline int fid_is_namespace_visible(const struct lu_fid *fid)
         * object or not. It is caller's duty to check more if needed. */
        return (!fid_is_last_id(fid) &&
                (fid_seq_is_norm(seq) || fid_seq_is_igif(seq))) ||
-              fid_is_root(fid) || fid_is_dot_lustre(fid);
+              fid_is_root(fid) || fid_seq_is_dot_lustre(seq);
 }
 
 static inline int fid_seq_in_fldb(__u64 seq)
index 1f85e1a..891becc 100644 (file)
@@ -1116,8 +1116,8 @@ static int lfsck_needs_scan_dir(const struct lu_env *env,
                        return 1;
                }
 
-               /* .lustre doesn't contain "real" user objects, no need lfsck */
-               if (fid_is_dot_lustre(lfsck_dto2fid(obj))) {
+               /* No need to check .lustre and its children. */
+               if (fid_seq_is_dot_lustre(fid_seq(lfsck_dto2fid(obj)))) {
                        if (depth > 0)
                                lfsck_object_put(env, obj);
                        return 0;
@@ -1167,10 +1167,16 @@ static int lfsck_needs_scan_dir(const struct lu_env *env,
                        return 0;
                }
 
-               /* Currently, only client visible directory can be remote. */
                if (dt_object_remote(obj)) {
+                       /* .lustre/lost+found/MDTxxx can be remote directory. */
+                       if (fid_seq_is_dot_lustre(fid_seq(lfsck_dto2fid(obj))))
+                               rc = 0;
+                       else
+                               /* Other remote directory should be client
+                                * visible and need to be checked. */
+                               rc = 1;
                        lfsck_object_put(env, obj);
-                       return 1;
+                       return rc;
                }
 
                depth++;
index 74a6cfc..586694f 100644 (file)
@@ -880,7 +880,7 @@ static int lfsck_namespace_exec_dir(const struct lu_env *env,
        if (ent->lde_name[0] == '.' &&
            (ent->lde_namelen == 1 ||
             (ent->lde_namelen == 2 && ent->lde_name[1] == '.') ||
-            fid_is_dot_lustre(&ent->lde_fid)))
+            fid_seq_is_dot_lustre(fid_seq(&ent->lde_fid))))
                GOTO(out, rc = 0);
 
        if (!(bk->lb_param & LPF_DRYRUN) &&