From ef1b815d77ae717f3ee701e2392fd3fe6c71906d Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 8 May 2013 02:57:29 +0800 Subject: [PATCH] LU-2915 lfsck: NO scrub for agent inode and remote parent Under DNE case, for the object on remote MDT, there will be an agent inode on the local MDT where the name entry resides. We do NOT build OI mapping for such agent inode, so OI scrub should skip it.The same for the "/REMOTE_PARENT_DIR". Signed-off-by: Fan Yong Change-Id: I164473bcba80043800d491639c027e7c13f30bd9 Reviewed-on: http://review.whamcloud.com/6332 Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: wangdi Tested-by: Maloo --- lustre/mdd/mdd_lfsck.c | 17 ++++++++++------- lustre/osd-ldiskfs/osd_compat.c | 1 + lustre/osd-ldiskfs/osd_handler.c | 4 ++++ lustre/osd-ldiskfs/osd_scrub.c | 3 ++- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lustre/mdd/mdd_lfsck.c b/lustre/mdd/mdd_lfsck.c index 7ab15f9..3adfda1 100644 --- a/lustre/mdd/mdd_lfsck.c +++ b/lustre/mdd/mdd_lfsck.c @@ -877,7 +877,8 @@ again: if (!mdd_object_exists(parent)) goto shrink; - /* XXX: need more processing for remote object in the future. */ + /* XXX: Currently, skip remote object, the consistency for + * remote object will be processed in LFSCK phase III. */ if (mdd_object_remote(parent)) { mdd_object_put(env, parent); ldata.ld_lee = LINKEA_NEXT_ENTRY(ldata); @@ -1752,7 +1753,8 @@ static int mdd_lfsck_namespace_double_scan(const struct lu_env *env, goto checkpoint; } - /* XXX: need more processing for remote object in the future. */ + /* XXX: Currently, skip remote object, the consistency for + * remote object will be processed in LFSCK phase III. */ if (!mdd_object_exists(target) || mdd_object_remote(target)) goto obj_put; @@ -2149,7 +2151,8 @@ static int mdd_lfsck_prep(struct lu_env *env, struct md_lfsck *lfsck) else if (IS_ERR(obj)) RETURN(PTR_ERR(obj)); - /* XXX: need more processing for remote object in the future. */ + /* XXX: Currently, skip remote object, the consistency for + * remote object will be processed in LFSCK phase III. */ if (!mdd_object_exists(obj) || mdd_object_remote(obj) || unlikely(!S_ISDIR(mdd_object_type(obj)))) GOTO(out, rc = 0); @@ -2390,7 +2393,8 @@ static int mdd_lfsck_dir_engine(const struct lu_env *env, goto checkpoint; } - /* XXX: need more processing for remote object in the future. */ + /* XXX: Currently, skip remote object, the consistency for + * remote object will be processed in LFSCK phase III. */ if (mdd_object_exists(child) && !mdd_object_remote(child)) rc = mdd_lfsck_exec_dir(env, lfsck, child, ent); mdd_object_put(env, child); @@ -2485,9 +2489,8 @@ static int mdd_lfsck_oit_engine(const struct lu_env *env, goto checkpoint; } - /* XXX: In fact, low layer otable-based iteration should not - * return agent object. But before LU-2646 resolved, we - * need more processing for agent object. */ + /* XXX: Currently, skip remote object, the consistency for + * remote object will be processed in LFSCK phase III. */ if (mdd_object_exists(target) && !mdd_object_remote(target)) rc = mdd_lfsck_exec_oit(env, lfsck, target); mdd_object_put(env, target); diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index f0061c7..4794d78 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -192,6 +192,7 @@ static int osd_mdt_init(const struct lu_env *env, struct osd_device *dev) if (IS_ERR(d)) GOTO(cleanup, rc = PTR_ERR(d)); + ldiskfs_set_inode_state(d->d_inode, LDISKFS_STATE_LUSTRE_NO_OI); omm->omm_remote_parent = d; /* Set LMA for remote parent inode */ diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 95538e5..bc52d58 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -4886,6 +4886,10 @@ again: GOTO(out_journal, rc); } + /* skip the REMOTE_PARENT_DIR. */ + if (inode == dev->od_mdt_map->omm_remote_parent->d_inode) + GOTO(out_inode, rc = 0); + rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma); if (rc == 0) { if (fid_is_sane(fid)) { diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index bf6a8b9..53dd70b 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -698,7 +698,8 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev, rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma); if (rc == 0) { if (fid_is_llog(&lma->lma_self_fid) || - (!scrub && fid_is_internal(&lma->lma_self_fid))) + (!scrub && fid_is_internal(&lma->lma_self_fid)) || + (scrub && (lma->lma_incompat & LMAI_AGENT))) rc = SCRUB_NEXT_CONTINUE; else *fid = lma->lma_self_fid; -- 1.8.3.1