Whamcloud - gitweb
b=13872
[fs/lustre-release.git] / lustre / ldlm / ldlm_lib.c
index f6b025d..b2f8c44 100644 (file)
@@ -274,6 +274,10 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
         spin_lock_init(&cli->cl_write_page_hist.oh_lock);
         spin_lock_init(&cli->cl_read_offset_hist.oh_lock);
         spin_lock_init(&cli->cl_write_offset_hist.oh_lock);
+#ifdef ENABLE_CHECKSUM
+        cli->cl_checksum = 1;
+#endif
+        atomic_set(&cli->cl_resends, OSC_DEFAULT_RESENDS);
 
         /* This value may be changed at connect time in
            ptlrpc_connect_interpret. */
@@ -352,7 +356,6 @@ int client_obd_cleanup(struct obd_device *obddev)
 {
         ENTRY;
         ldlm_put_ref(obddev->obd_force);
-
         RETURN(0);
 }
 
@@ -382,7 +385,8 @@ int client_connect_import(const struct lu_env *env,
         if (obd->obd_namespace != NULL)
                 CERROR("already have namespace!\n");
         obd->obd_namespace = ldlm_namespace_new(obd->obd_name,
-                                                LDLM_NAMESPACE_CLIENT);
+                                                LDLM_NAMESPACE_CLIENT,
+                                                LDLM_NAMESPACE_GREEDY);
         if (obd->obd_namespace == NULL)
                 GOTO(out_disco, rc = -ENOMEM);
 
@@ -546,7 +550,7 @@ void target_client_add_cb(struct obd_device *obd, __u64 transno, void *cb_data,
 {
         struct obd_export *exp = cb_data;
 
-        CDEBUG(D_HA, "%s: committing for initial connect of %s\n",
+        CDEBUG(D_RPCTRACE, "%s: committing for initial connect of %s\n",
                obd->obd_name, exp->exp_client_uuid.uuid);
 
         spin_lock(&exp->exp_lock);
@@ -574,7 +578,7 @@ int target_handle_connect(struct ptlrpc_request *req)
 
         OBD_RACE(OBD_FAIL_TGT_CONN_RACE);
 
-        LASSERT_REQSWAB(req, REQ_REC_OFF);
+        lustre_set_req_swabbed(req, REQ_REC_OFF);
         str = lustre_msg_string(req->rq_reqmsg, REQ_REC_OFF, sizeof(tgtuuid)-1);
         if (str == NULL) {
                 DEBUG_REQ(D_ERROR, req, "bad target UUID for connect");
@@ -607,7 +611,7 @@ int target_handle_connect(struct ptlrpc_request *req)
            Really, class_uuid2obd should take the ref. */
         targref = class_incref(target);
 
-        LASSERT_REQSWAB(req, REQ_REC_OFF + 1);
+        lustre_set_req_swabbed(req, REQ_REC_OFF + 1);
         str = lustre_msg_string(req->rq_reqmsg, REQ_REC_OFF + 1,
                                 sizeof(cluuid) - 1);
         if (str == NULL) {
@@ -867,13 +871,6 @@ dont_check_exports:
                                                        req->rq_self,
                                                        &remote_uuid);
 
-        if (lustre_msg_get_op_flags(req->rq_repmsg) & MSG_CONNECT_RECONNECT) {
-                LASSERT(export->exp_imp_reverse);
-                sptlrpc_svc_install_rvs_ctx(export->exp_imp_reverse,
-                                            req->rq_svc_ctx);
-                GOTO(out, rc = 0);
-        }
-
         spin_lock_bh(&target->obd_processing_task_lock);
         if (target->obd_recovering && !export->exp_in_recovery) {
                 spin_lock(&export->exp_lock);
@@ -1046,6 +1043,7 @@ void ptlrpc_free_clone( struct ptlrpc_request *req)
         OBD_FREE_PTR(req);
 }
 
+#ifdef __KERNEL__
 static void target_finish_recovery(struct obd_device *obd)
 {
         ENTRY;
@@ -1094,6 +1092,7 @@ static void abort_lock_replay_queue(struct obd_device *obd)
                 ptlrpc_free_clone(req);
         }
 }
+#endif
 
 /* Called from a cleanup function if the device is being cleaned up
    forcefully.  The exports should all have been disconnected already,
@@ -1178,7 +1177,7 @@ void target_start_recovery_timer(struct obd_device *obd)
 {
         spin_lock_bh(&obd->obd_processing_task_lock);
         if (obd->obd_recovery_handler
-            || timer_pending(&obd->obd_recovery_timer)) {
+            || timer_pending((struct timer_list *)&obd->obd_recovery_timer)) {
                 spin_unlock_bh(&obd->obd_processing_task_lock);
                 return;
         }
@@ -1785,6 +1784,36 @@ struct obd_device * target_req2obd(struct ptlrpc_request *req)
         return req->rq_export->exp_obd;
 }
 
+static inline struct ldlm_pool *ldlm_exp2pl(struct obd_export *exp)
+{
+        LASSERT(exp != NULL);
+        return &exp->exp_obd->obd_namespace->ns_pool;
+}
+
+int target_pack_pool_reply(struct ptlrpc_request *req)
+{
+        struct ldlm_pool *pl;
+        ENTRY;
+   
+        if (req->rq_export == NULL) {
+                lustre_msg_set_slv(req->rq_repmsg, 0);
+                lustre_msg_set_limit(req->rq_repmsg, 0);
+                RETURN(0);
+        }
+        if (!exp_connect_lru_resize(req->rq_export))
+                RETURN(0);
+        
+        pl = ldlm_exp2pl(req->rq_export);
+
+        spin_lock(&pl->pl_lock);
+        lustre_msg_set_slv(req->rq_repmsg, ldlm_pool_get_slv(pl));
+        lustre_msg_set_limit(req->rq_repmsg, ldlm_pool_get_limit(pl));
+        spin_unlock(&pl->pl_lock);
+
+        RETURN(0);
+}
+
 int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
 {
         if (OBD_FAIL_CHECK(fail_id | OBD_FAIL_ONCE)) {
@@ -1801,6 +1830,7 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
                 DEBUG_REQ(D_NET, req, "sending reply");
         }
 
+        target_pack_pool_reply(req);
         return (ptlrpc_send_reply(req, 1));
 }
 
@@ -1812,6 +1842,9 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
         struct obd_export         *exp;
         struct ptlrpc_service     *svc;
 
+        if (req->rq_no_reply)
+                return;
+
         svc = req->rq_rqbd->rqbd_service;
         rs = req->rq_reply_state;
         if (rs == NULL || !rs->rs_difficult) {