From 81af631d07084074c6c0346435e7011a6b4582f7 Mon Sep 17 00:00:00 2001 From: Andriy Skulysh Date: Thu, 3 May 2018 13:07:22 +0300 Subject: [PATCH] LU-11135 mdt: LASSERT(lu_object_exists(o)) fails mdt_object_find() can return a vaild nonexisting object. It's return value needs to be checked additionaly if exists. Change-Id: Ib1f5bd5289a69e29437db520706591929bf55830 Cray-bug-id: LUS-6192 Signed-off-by: Andriy Skulysh Reviewed-on: https://review.whamcloud.com/32803 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alexandr Boyko Reviewed-by: Andrew Perepechko Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_reint.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 5c451c0..62308a8 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -1504,6 +1504,13 @@ static int mdt_reint_migrate_internal(struct mdt_thread_info *info, if (IS_ERR(mold)) GOTO(out_unlock_parent, rc = PTR_ERR(mold)); + if (!mdt_object_exists(mold)) { + LU_OBJECT_DEBUG(D_INODE, info->mti_env, + &mold->mot_obj, + "object does not exist"); + GOTO(out_put_child, rc = -ENOENT); + } + if (mdt_object_remote(mold)) { CDEBUG(D_OTHER, "%s: source "DFID" is on the remote MDT\n", mdt_obd_name(info->mti_mdt), PFID(old_fid)); @@ -1987,6 +1994,13 @@ relock: if (IS_ERR(mold)) GOTO(out_unlock_parents, rc = PTR_ERR(mold)); + if (!mdt_object_exists(mold)) { + LU_OBJECT_DEBUG(D_INODE, info->mti_env, + &mold->mot_obj, + "object does not exist"); + GOTO(out_put_old, rc = -ENOENT); + } + /* Check if @mtgtdir is subdir of @mold, before locking child * to avoid reverse locking. */ if (mtgtdir != msrcdir) { @@ -2033,6 +2047,13 @@ relock: if (IS_ERR(mnew)) GOTO(out_put_old, rc = PTR_ERR(mnew)); + if (!mdt_object_exists(mnew)) { + LU_OBJECT_DEBUG(D_INODE, info->mti_env, + &mnew->mot_obj, + "object does not exist"); + GOTO(out_put_new, rc = -ENOENT); + } + if (mdt_object_remote(mnew)) { struct mdt_body *repbody; -- 1.8.3.1