Whamcloud - gitweb
Remove global atomic counter for MDS opens, it just slows things down.
[fs/lustre-release.git] / lustre / mds / mds_open.c
index b159950..244b593 100644 (file)
@@ -841,8 +841,10 @@ int mds_open(struct mds_update_record *rec, int offset,
          * opened this file and is only replaying the RPC, so we open the
          * inode by fid (at some large expense in security). */
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
-                DEBUG_REQ(D_HA, req, "open replay, disp: "LPX64"\n",
-                          rep->lock_policy_res1);
+                DEBUG_REQ(D_HA, req, "open replay");
+                CDEBUG(D_HA, "open fid "LPU64"/%u name %*s mode %o\n",
+                          rec->ur_fid2->id, rec->ur_fid2->generation,
+                          rec->ur_namelen - 1, rec->ur_name, rec->ur_mode);
 
                 LASSERT(rec->ur_fid2->id);
 
@@ -1128,7 +1130,9 @@ got_child:
                                        err);
                         }
                 } else if (created) {
+#if 0
                         mds_lock_new_child(obd, dchild->d_inode, NULL);
+#endif
                 }
                 l_dput(dchild);
         case 1:
@@ -1145,8 +1149,6 @@ got_child:
                 else
                         ptlrpc_save_lock (req, parent_lockh, parent_mode);
         }
-        if (rc == 0)
-                atomic_inc(&mds->mds_open_count);
         if (mea)
                 OBD_FREE(mea, mea_size);
         RETURN(rc);
@@ -1174,6 +1176,7 @@ int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
         struct mds_body *request_body = NULL, *reply_body = NULL;
         struct dentry_params dp;
         struct iattr iattr = { 0 };
+        struct llog_create_locks *lcl = NULL;
         ENTRY;
 
         if (req && req->rq_reqmsg != NULL)
@@ -1235,15 +1238,6 @@ int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
                         GOTO(cleanup, rc);
                 }
 
-                if (req != NULL && req->rq_repmsg != NULL &&
-                    (reply_body->valid & OBD_MD_FLEASIZE) &&
-                    mds_log_op_unlink(obd, pending_child->d_inode, lmm,
-                                      req->rq_repmsg->buflens[1],
-                                      lustre_msg_buf(req->rq_repmsg, 2, 0),
-                                      req->rq_repmsg->buflens[2]) > 0) {
-                        reply_body->valid |= OBD_MD_FLCOOKIE;
-                }
-
                 pending_child->d_fsdata = (void *) &dp;
                 dp.p_inum = 0;
                 dp.p_ptr = req;
@@ -1254,6 +1248,15 @@ int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
                 if (rc)
                         CERROR("error unlinking orphan %s: rc %d\n",fidname,rc);
 
+                if (req != NULL && req->rq_repmsg != NULL &&
+                    (reply_body->valid & OBD_MD_FLEASIZE) &&
+                    mds_log_op_unlink(obd, pending_child->d_inode,
+                                                lmm, req->rq_repmsg->buflens[1],
+                                                lustre_msg_buf(req->rq_repmsg, 2, 0),
+                                                req->rq_repmsg->buflens[2], &lcl) > 0) {
+                        reply_body->valid |= OBD_MD_FLCOOKIE;
+                }
+
                 goto out; /* Don't bother updating attrs on unlinked inode */
         }
 
@@ -1319,7 +1322,6 @@ out:
         mds_mfd_destroy(mfd);
 
  cleanup:
-        atomic_dec(&mds->mds_open_count);
         if (req != NULL && reply_body != NULL) {
                 rc = mds_finish_transno(mds, pending_dir, handle, req, rc, 0);
         } else if (handle) {
@@ -1333,6 +1335,8 @@ out:
 
         switch (cleanup_phase) {
         case 2:
+                if (lcl != NULL)
+                        ptlrpc_save_llog_lock(req, lcl);
                 dput(pending_child);
         case 1:
                 up(&pending_dir->i_sem);
@@ -1361,6 +1365,13 @@ int mds_close(struct ptlrpc_request *req)
                 MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
         }
 
+        if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
+                DEBUG_REQ(D_HA, req, "close replay\n");
+                memcpy(lustre_msg_buf(req->rq_repmsg, 2, 0),
+                       lustre_msg_buf(req->rq_reqmsg, 1, 0),
+                       req->rq_repmsg->buflens[2]);
+        }
+
         body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
         if (body == NULL) {
                 CERROR("Can't unpack body\n");