From: Lai Siyao Date: Thu, 13 Apr 2017 09:54:53 +0000 (+0800) Subject: LU-5163 mdd: migrated entry may not exist X-Git-Tag: 2.10.4-RC1~72 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F31281%2F2;p=fs%2Flustre-release.git LU-5163 mdd: migrated entry may not exist During dirent migration, we shouldn't assert file exists. Lustre-change: https://review.whamcloud.com/26620 Lustre-commit: 542b76d142c491a0a1bf8a2f4fd22af4733f59cb Signed-off-by: Lai Siyao Change-Id: I11bbc5556007ec045b7a5d57a250981082ef6d70 Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/31281 Tested-by: Jenkins Tested-by: Maloo --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 8598f2e..0bd6fa3 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -3691,8 +3691,11 @@ static int mdd_migrate_entries(const struct lu_env *env, if (IS_ERR(child)) GOTO(out, rc = PTR_ERR(child)); + /* child may not exist, but lu_object_attr will assert this, + * get type from loh_attr directly */ + is_dir = S_ISDIR(child->mod_obj.mo_lu.lo_header->loh_attr); + mdd_write_lock(env, child, MOR_SRC_CHILD); - is_dir = S_ISDIR(mdd_object_type(child)); snprintf(name, ent->lde_namelen + 1, "%s", ent->lde_name); @@ -3716,9 +3719,9 @@ static int mdd_migrate_entries(const struct lu_env *env, handle->th_local = 1; if (likely(!target_exist)) { rc = mdo_declare_index_insert(env, mdd_tobj, - &ent->lde_fid, - mdd_object_type(child), - name, handle); + &ent->lde_fid, + child->mod_obj.mo_lu.lo_header->loh_attr, + name, handle); if (rc != 0) GOTO(out_put, rc); @@ -3767,8 +3770,8 @@ static int mdd_migrate_entries(const struct lu_env *env, if (likely(!target_exist)) { rc = __mdd_index_insert(env, mdd_tobj, &ent->lde_fid, - mdd_object_type(child), - name, handle); + child->mod_obj.mo_lu.lo_header->loh_attr, name, + handle); if (rc != 0) GOTO(out_put, rc); }