Whamcloud - gitweb
LU-11135 mdt: LASSERT(lu_object_exists(o)) fails 03/32803/4
authorAndriy Skulysh <c17819@cray.com>
Thu, 3 May 2018 10:07:22 +0000 (13:07 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Aug 2018 05:14:09 +0000 (05:14 +0000)
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 <c17819@cray.com>
Reviewed-on: https://review.whamcloud.com/32803
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alexandr Boyko <c17825@cray.com>
Reviewed-by: Andrew Perepechko <c17827@cray.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_reint.c

index 5c451c0..62308a8 100644 (file)
@@ -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;