Whamcloud - gitweb
LU-220 open: try open_by_fid for the known object
[fs/lustre-release.git] / lustre / mdt / mdt_open.c
index 613a681..7f90392 100644 (file)
@@ -1273,33 +1273,30 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                PFID(rr->rr_fid2), create_flags,
                ma->ma_attr.la_mode, msg_flags);
 
-        if (req_is_replay(req) ||
-            (req->rq_export->exp_libclient && create_flags&MDS_OPEN_HAS_EA)) {
-                /* This is a replay request or from liblustre with ea. */
-                result = mdt_open_by_fid(info, ldlm_rep);
-
-                if (result != -ENOENT) {
-                        if (req->rq_export->exp_libclient &&
-                            create_flags & MDS_OPEN_HAS_EA)
-                                GOTO(out, result = 0);
-                        GOTO(out, result);
-                }
-                /*
-                 * We didn't find the correct object, so we need to re-create it
-                 * via a regular replay.
-                 */
-                if (!(create_flags & MDS_OPEN_CREAT)) {
-                        DEBUG_REQ(D_ERROR, req,
-                                  "OPEN & CREAT not in open replay.");
-                        GOTO(out, result = -EFAULT);
-                }
-                CDEBUG(D_INFO, "Open replay did find object, continue as "
-                       "regular open\n");
-        } else if (rr->rr_namelen == 0 && !info->mti_cross_ref &&
-                   create_flags & MDS_OPEN_LOCK) {
-                result = mdt_open_anon_by_fid(info, ldlm_rep, lhc);
-                GOTO(out, result);
-        }
+       if ((create_flags & MDS_OPEN_BY_FID) || req_is_replay(req) ||
+           (req->rq_export->exp_libclient && create_flags & MDS_OPEN_HAS_EA)) {
+               /* This is a replay request or from liblustre with ea. */
+               result = mdt_open_by_fid(info, ldlm_rep);
+
+               if (result != -ENOENT) {
+                       if (req->rq_export->exp_libclient &&
+                           create_flags & MDS_OPEN_HAS_EA)
+                               GOTO(out, result = 0);
+                       GOTO(out, result);
+               }
+               /* We didn't find the correct object, so we need to re-create it
+                * via a regular replay. */
+               if (!(create_flags & (MDS_OPEN_CREAT | MDS_OPEN_BY_FID))) {
+                       DEBUG_REQ(D_ERROR, req,
+                                 "OPEN & CREAT not in open replay/by_fid.");
+                       GOTO(out, result = -EFAULT);
+               }
+               CDEBUG(D_INFO, "No object, continue as regular open.\n");
+       } else if (rr->rr_namelen == 0 && !info->mti_cross_ref &&
+                  create_flags & MDS_OPEN_LOCK) {
+               result = mdt_open_anon_by_fid(info, ldlm_rep, lhc);
+               GOTO(out, result);
+       }
 
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OPEN_PACK))
                 GOTO(out, result = err_serious(-ENOMEM));