RETURN(ost_rw_prolong_locks(req, ioo, nb, &body->oa, mode));
}
+static void ost_rw_hpreq_fini(struct ptlrpc_request *req)
+{
+ (void)ost_rw_hpreq_check(req);
+}
+
static int ost_punch_prolong_locks(struct ptlrpc_request *req, struct obdo *oa)
{
struct ldlm_res_id res_id = { .name = { oa->o_id } };
RETURN(ost_punch_prolong_locks(req, &body->oa));
}
+static void ost_punch_hpreq_fini(struct ptlrpc_request *req)
+{
+ (void)ost_punch_hpreq_check(req);
+}
+
struct ptlrpc_hpreq_ops ost_hpreq_rw = {
.hpreq_lock_match = ost_rw_hpreq_lock_match,
.hpreq_check = ost_rw_hpreq_check,
+ .hpreq_fini = ost_rw_hpreq_fini,
};
struct ptlrpc_hpreq_ops ost_hpreq_punch = {
.hpreq_lock_match = ost_punch_hpreq_lock_match,
.hpreq_check = ost_punch_hpreq_check,
+ .hpreq_fini = ost_punch_hpreq_fini,
};
/** Assign high priority operations to the request if needed. */
/* forward ref */
static int ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc);
+static void ptlrpc_hpreq_fini(struct ptlrpc_request *req);
static CFS_LIST_HEAD (ptlrpc_all_services);
spinlock_t ptlrpc_all_services_lock;
*/
static void ptlrpc_server_finish_request(struct ptlrpc_request *req)
{
+ ptlrpc_hpreq_fini(req);
ptlrpc_server_drop_request(req);
}
static int ptlrpc_hpreq_init(struct ptlrpc_service *svc,
struct ptlrpc_request *req)
{
- int rc;
+ int rc = 0;
ENTRY;
if (svc->srv_hpreq_handler) {
RETURN(rc);
}
if (req->rq_export && req->rq_ops) {
+ /* Perform request specific check. We should do this check
+ * before the request is added into exp_queued_rpc list
+ * otherwise it may hit swab race at LU-1044. */
+ if (req->rq_ops->hpreq_check)
+ rc = req->rq_ops->hpreq_check(req);
+
spin_lock(&req->rq_export->exp_lock);
list_add(&req->rq_exp_list, &req->rq_export->exp_queued_rpc);
spin_unlock(&req->rq_export->exp_lock);
}
- RETURN(0);
+ RETURN(rc);
}
/** Remove the request from the export list. */
{
ENTRY;
if (req->rq_export && req->rq_ops) {
+ /* refresh lock timeout again so that client has more
+ * room to send lock cancel RPC. */
+ if (req->rq_ops->hpreq_fini)
+ req->rq_ops->hpreq_fini(req);
+
spin_lock(&req->rq_export->exp_lock);
list_del_init(&req->rq_exp_list);
spin_unlock(&req->rq_export->exp_lock);
list_move_tail(&req->rq_list, &svc->srv_request_hpq);
req->rq_hp = 1;
if (opc != OBD_PING)
- DEBUG_REQ(D_NET, req, "high priority req");
+ DEBUG_REQ(D_RPCTRACE, req, "high priority req");
}
spin_unlock(&req->rq_lock);
EXIT;
}
/** Check if the request if a high priority one. */
-static int ptlrpc_server_hpreq_check(struct ptlrpc_request *req)
+static int ptlrpc_server_hpreq_check(struct ptlrpc_service *svc,
+ struct ptlrpc_request *req)
{
- int opc, rc = 0;
ENTRY;
/* Check by request opc. */
- opc = lustre_msg_get_opc(req->rq_reqmsg);
- if (opc == OBD_PING)
+ if (OBD_PING == lustre_msg_get_opc(req->rq_reqmsg))
RETURN(1);
- /* Perform request specific check. */
- if (req->rq_ops && req->rq_ops->hpreq_check)
- rc = req->rq_ops->hpreq_check(req);
- RETURN(rc);
+ RETURN(ptlrpc_hpreq_init(svc, req));
}
/** Check if a request is a high priority one. */
int rc;
ENTRY;
- rc = ptlrpc_server_hpreq_check(req);
+ rc = ptlrpc_server_hpreq_check(svc, req);
if (rc < 0)
RETURN(rc);
goto err_req;
}
- CDEBUG(D_NET, "got req "LPU64"\n", req->rq_xid);
+ CDEBUG(D_RPCTRACE, "got req "LPU64"\n", req->rq_xid);
req->rq_export = class_conn2export(
lustre_msg_get_handle(req->rq_reqmsg));
}
ptlrpc_at_add_timed(req);
- rc = ptlrpc_hpreq_init(svc, req);
- if (rc)
- GOTO(err_req, rc);
/* Move it over to the request processing queue */
rc = ptlrpc_server_request_add(svc, req);
ptlrpc_rqphase_move(request, RQ_PHASE_INTERPRET);
spin_unlock(&svc->srv_lock);
- ptlrpc_hpreq_fini(request);
-
if(OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DUMP_LOG))
libcfs_debug_dumplog();
list_del(&req->rq_list);
service->srv_n_queued_reqs--;
service->srv_n_active_reqs++;
- ptlrpc_hpreq_fini(req);
ptlrpc_server_finish_request(req);
}
LASSERT(service->srv_n_queued_reqs == 0);