From: wang di Date: Tue, 17 Dec 2013 00:06:22 +0000 (-0800) Subject: LU-3528 mdt: check object exists for remote directory X-Git-Tag: 2.5.53~19 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a0120ccb3f5f54b0a5375fd8ab3396c7f51cdd02 LU-3528 mdt: check object exists for remote directory Check whether the remote object exists before enqueue and getattr to avoid LBUG. Remove unnecssary remote object exist check in mdd_object_lock. Signed-off-by: wang di Change-Id: Ia634a8c7b9cd2810515e854163c5fdd6bdf8716f Reviewed-on: http://review.whamcloud.com/8371 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 69d4c30..52a0cf6 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -2004,7 +2004,6 @@ static int mdd_object_lock(const struct lu_env *env, void *policy) { struct mdd_object *mdd_obj = md2mdd_obj(obj); - LASSERT(mdd_object_exists(mdd_obj)); return dt_object_lock(env, mdd_object_child(mdd_obj), lh, einfo, policy); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 8daf7e1..1ad4f40 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1325,6 +1325,14 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, } if (rc == 0) { /* Finally, we can get attr for child. */ + if (!mdt_object_exists(child)) { + LU_OBJECT_DEBUG(D_INFO, info->mti_env, + &child->mot_obj, + "remote object doesn't exist.\n"); + mdt_object_unlock(info, child, lhc, 1); + RETURN(-ENOENT); + } + mdt_set_capainfo(info, 0, mdt_object_fid(child), BYPASS_CAPA); rc = mdt_getattr_internal(info, child, 0); diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 5b5a1b0..7e89ad6 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -950,6 +950,13 @@ static int mdt_reint_link(struct mdt_thread_info *info, if (IS_ERR(ms)) GOTO(out_unlock_parent, rc = PTR_ERR(ms)); + if (!mdt_object_exists(ms)) { + mdt_object_put(info->mti_env, ms); + CDEBUG(D_INFO, "%s: "DFID" does not exist.\n", + mdt_obd_name(info->mti_mdt), PFID(rr->rr_fid1)); + GOTO(out_unlock_parent, rc = -ENOENT); + } + if (mdt_object_remote(ms)) { mdt_object_put(info->mti_env, ms); CERROR("%s: source inode "DFID" on remote MDT from "DFID"\n",