Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / ost / ost_handler.c
index fa1713b..faf551d 100644 (file)
@@ -218,6 +218,7 @@ static int ost_create(struct obd_export *exp, struct ptlrpc_request *req,
                                  sizeof(*repbody));
         memcpy(&repbody->oa, &body->oa, sizeof(body->oa));
         oti->oti_logcookies = &repbody->oa.o_lcookie;
+        
         req->rq_status = obd_create(exp, &repbody->oa, NULL, oti);
         //obd_log_cancel(conn, NULL, 1, oti->oti_logcookies, 0);
         RETURN(0);
@@ -538,6 +539,10 @@ static int ost_prolong_locks_iter(struct ldlm_lock *lock, void *data)
                 return LDLM_ITER_CONTINUE;
         }
 
+        CDEBUG(D_DLMTRACE,"refresh lock: "LPU64"/"LPU64" ("LPU64"->"LPU64")\n",
+               lock->l_resource->lr_name.name[0],
+               lock->l_resource->lr_name.name[1],
+               opd->opd_policy.l_extent.start, opd->opd_policy.l_extent.end);
         /* OK. this is a possible lock the user holds doing I/O
          * let's refresh eviction timer for it */
         ldlm_refresh_waiting_lock(lock, opd->opd_timeout);
@@ -569,7 +574,7 @@ static int ost_rw_prolong_locks(struct ptlrpc_request *req, struct obd_ioobj *ob
                           max(at_est2timeout(at_get(&req->rq_rqbd->
                               rqbd_service->srv_at_estimate)), ldlm_timeout);
 
-        CDEBUG(D_DLMTRACE,"refresh locks: "LPU64"/"LPU64" ("LPU64"->"LPU64")\n",
+        CDEBUG(D_INFO,"refresh locks: "LPU64"/"LPU64" ("LPU64"->"LPU64")\n",
                res_id.name[0], res_id.name[1], opd.opd_policy.l_extent.start,
                opd.opd_policy.l_extent.end);
 
@@ -769,7 +774,9 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                                                            desc);
                                 rc = l_wait_event(desc->bd_waitq,
                                                   !ptlrpc_server_bulk_active(desc) ||
-                                                  exp->exp_failed, &lwi);
+                                                  exp->exp_failed ||
+                                                  exp->exp_abort_active_req,
+                                                  &lwi);
                                 LASSERT(rc == 0 || rc == -ETIMEDOUT);
                                 /* Wait again if we changed deadline */
                         } while ((rc == -ETIMEDOUT) &&
@@ -786,6 +793,11 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                                 DEBUG_REQ(D_ERROR, req, "Eviction on bulk PUT");
                                 rc = -ENOTCONN;
                                 ptlrpc_abort_bulk(desc);
+                        } else if (exp->exp_abort_active_req) {
+                                DEBUG_REQ(D_ERROR, req, "Reconnect on bulk PUT");
+                                /* we don't reply anyway */
+                                rc = -ETIMEDOUT;
+                                ptlrpc_abort_bulk(desc);
                         } else if (!desc->bd_success ||
                                    desc->bd_nob_transferred != desc->bd_nob) {
                                 DEBUG_REQ(D_ERROR, req, "%s bulk PUT %d(%d)",
@@ -891,6 +903,10 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         body = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF, sizeof(*body));
         LASSERT(body != NULL);
 
+        if ((body->oa.o_flags & OBD_BRW_MEMALLOC) &&
+            (exp->exp_connection->c_peer.nid == exp->exp_connection->c_self))
+                libcfs_memory_pressure_set();
+
         objcount = lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 1) /
                 sizeof(*ioo);
         ioo = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF + 1,
@@ -999,7 +1015,9 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
                                                    ost_bulk_timeout, desc);
                         rc = l_wait_event(desc->bd_waitq,
                                           !ptlrpc_server_bulk_active(desc) ||
-                                          desc->bd_export->exp_failed, &lwi);
+                                          desc->bd_export->exp_failed ||
+                                          desc->bd_export->exp_abort_active_req,
+                                          &lwi);
                         LASSERT(rc == 0 || rc == -ETIMEDOUT);
                         /* Wait again if we changed deadline */
                 } while ((rc == -ETIMEDOUT) &&
@@ -1016,6 +1034,11 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
                         DEBUG_REQ(D_ERROR, req, "Eviction on bulk GET");
                         rc = -ENOTCONN;
                         ptlrpc_abort_bulk(desc);
+                } else if (desc->bd_export->exp_abort_active_req) {
+                        DEBUG_REQ(D_ERROR, req, "Reconnect on bulk GET");
+                        /* we don't reply anyway */
+                        rc = -ETIMEDOUT;
+                        ptlrpc_abort_bulk(desc);
                 } else if (!desc->bd_success) {
                         DEBUG_REQ(D_ERROR, req, "network error on bulk GET");
                         /* XXX should this be a different errno? */
@@ -1147,6 +1170,7 @@ out:
                       exp->exp_connection->c_remote_uuid.uuid,
                       libcfs_id2str(req->rq_peer));
         }
+        libcfs_memory_pressure_clr();
         RETURN(rc);
 }
 
@@ -1168,7 +1192,7 @@ static int ost_set_info(struct obd_export *exp, struct ptlrpc_request *req)
         if (KEY_IS(KEY_GRANT_SHRINK)) {
                 rc = lustre_pack_reply(req, 2, size, NULL);
                 if (rc)
-                        RETURN(rc); 
+                        RETURN(rc);
         } else {
                 rc = lustre_pack_reply(req, 1, NULL, NULL);
                 if (rc)
@@ -1177,27 +1201,29 @@ static int ost_set_info(struct obd_export *exp, struct ptlrpc_request *req)
 
         vallen = lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 1);
         if (vallen) {
-                if (KEY_IS(KEY_GRANT_SHRINK)) { 
-                        body = lustre_swab_reqbuf(req, REQ_REC_OFF + 1, 
+                if (KEY_IS(KEY_GRANT_SHRINK)) {
+                        body = lustre_swab_reqbuf(req, REQ_REC_OFF + 1,
                                                   sizeof(*body),
                                                   lustre_swab_ost_body);
                         if (!body)
                                 RETURN(-EFAULT);
 
-                        repbody = lustre_msg_buf(req->rq_repmsg, 
+                        repbody = lustre_msg_buf(req->rq_repmsg,
                                                  REPLY_REC_OFF,
                                                  sizeof(*repbody));
                         memcpy(repbody, body, sizeof(*body));
                         val = (char*)repbody;
-                } else 
+                } else
                         val = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF + 1,0);
         }
 
         if (KEY_IS(KEY_EVICT_BY_NID)) {
                 if (val && vallen)
                         obd_export_evict_by_nid(exp->exp_obd, val);
-
                 GOTO(out, rc = 0);
+        } else if (KEY_IS(KEY_MDS_CONN) && lustre_msg_swabbed(req->rq_reqmsg)) {
+                /* Val's are not swabbed automatically */
+                __swab32s((__u32 *)val);
         }
 
         rc = obd_set_info_async(exp, keylen, key, vallen, val, NULL);
@@ -1455,6 +1481,12 @@ static int ost_connect_check_sptlrpc(struct ptlrpc_request *req)
         struct sptlrpc_flavor  flvr;
         int                    rc = 0;
 
+        if (unlikely(strcmp(exp->exp_obd->obd_type->typ_name,
+                            LUSTRE_ECHO_NAME) == 0)) {
+                exp->exp_flvr.sf_rpc = SPTLRPC_FLVR_ANY;
+                return 0;
+        }
+
         if (exp->exp_flvr.sf_rpc == SPTLRPC_FLVR_INVALID) {
                 read_lock(&filter->fo_sptlrpc_lock);
                 sptlrpc_target_choose_flavor(&filter->fo_sptlrpc_rset,
@@ -1628,7 +1660,7 @@ static int ost_rw_hpreq_lock_match(struct ptlrpc_request *req,
                nb[ioo->ioo_bufcnt - 1].len - 1) | ~CFS_PAGE_MASK;
 
         LASSERT(lock->l_resource != NULL);
-        if (!osc_res_name_eq(ioo->ioo_id, ioo->ioo_gr, 
+        if (!osc_res_name_eq(ioo->ioo_id, ioo->ioo_gr,
                              &lock->l_resource->lr_name))
                 RETURN(0);