Whamcloud - gitweb
LU-12752 mdt: commitrw_write() - check dying object under lock
[fs/lustre-release.git] / lustre / mdt / mdt_io.c
index 5924aa1..7e564d1 100644 (file)
@@ -611,12 +611,6 @@ static int mdt_commitrw_write(const struct lu_env *env, struct obd_export *exp,
 retry:
        if (!dt_object_exists(dob))
                GOTO(out, rc = -ENOENT);
-       if (lu_object_is_dying(&mo->mot_header)) {
-               /* Commit to stale object can be just skipped silently. */
-               CDEBUG(D_INODE, "skip commit to stale object "DFID"\n",
-                       PFID(mdt_object_fid(mo)));
-               GOTO(out, rc = 0);
-       }
 
        if (niocount == 0) {
                rc = -EPROTO;
@@ -626,6 +620,8 @@ retry:
                GOTO(out, rc);
        }
 
+       CFS_FAIL_TIMEOUT(OBD_FAIL_MDS_COMMITRW_DELAY, cfs_fail_val);
+
        th = dt_trans_create(env, dt);
        if (IS_ERR(th))
                GOTO(out, rc = PTR_ERR(th));
@@ -657,6 +653,12 @@ retry:
                GOTO(out_stop, rc);
 
        dt_write_lock(env, dob, 0);
+       if (lu_object_is_dying(&mo->mot_header)) {
+               /* Commit to stale object can be just skipped silently. */
+               CDEBUG(D_INODE, "skip commit to stale object "DFID"\n",
+                       PFID(mdt_object_fid(mo)));
+               GOTO(unlock, rc = 0);
+       }
        rc = dt_write_commit(env, dob, lnb, niocount, th, oa->o_size);
        if (rc) {
                restart = th->th_restart_tran;