From: Fan Yong Date: Sat, 5 Apr 2014 02:28:00 +0000 (+0800) Subject: LU-4972 lfsck: skip .lustre and children for namespace check X-Git-Tag: 2.5.59~24 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=08e888a20ec87b3e9dfccbae34cc2cfe98f848e6;hp=cb22837bcded8f95461c0d4760b2b9add0956e71 LU-4972 lfsck: skip .lustre and children for namespace check 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 Change-Id: I39e8382c226b2ee19a41e6f47af38a5367f3bdd8 Reviewed-on: http://review.whamcloud.com/10143 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao --- diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 79e956f..769dee5 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -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) diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index 1f85e1a..891becc 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -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++; diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 74a6cfc..586694f 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -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) &&