Whamcloud - gitweb
LU-7173 mdt: intent vs unlink race
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index e27fee3..216cb4d 100644 (file)
@@ -1436,6 +1436,13 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                GOTO(out_parent, rc = PTR_ERR(child));
 
        OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_RESEND, obd_timeout * 2);
+       if (!mdt_object_exists(child)) {
+               LU_OBJECT_DEBUG(D_INODE, info->mti_env,
+                               &child->mot_obj,
+                               "Object doesn't exist!\n");
+               GOTO(out_child, rc = -ENOENT);
+       }
+
        rc = mdt_check_resent_lock(info, child, lhc);
        if (rc < 0) {
                GOTO(out_child, rc);
@@ -1444,13 +1451,6 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                mdt_lock_reg_init(lhc, LCK_PR);
                try_layout = false;
 
-               if (!mdt_object_exists(child)) {
-                       LU_OBJECT_DEBUG(D_INODE, info->mti_env,
-                                       &child->mot_obj,
-                                       "Object doesn't exist!\n");
-                       GOTO(out_child, rc = -ENOENT);
-               }
-
                if (!(child_bits & MDS_INODELOCK_UPDATE) &&
                      mdt_object_exists(child) && !mdt_object_remote(child)) {
                         struct md_attr *ma = &info->mti_attr;
@@ -3390,6 +3390,8 @@ static int mdt_intent_opc(enum ldlm_intent_flags itopc,
        if (flv->it_act != NULL) {
                struct ldlm_reply *rep;
 
+               OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_INTENT_DELAY, 10);
+
                /* execute policy */
                rc = flv->it_act(opc, info, lockp, flags);