Whamcloud - gitweb
LU-1239 ldlm: cascading client reconnects
[fs/lustre-release.git] / lustre / ptlrpc / service.c
index b07dbe8..28bb89a 100644 (file)
@@ -1475,6 +1475,32 @@ static void ptlrpc_hpreq_fini(struct ptlrpc_request *req)
         EXIT;
 }
 
+static int ptlrpc_hpreq_check(struct ptlrpc_request *req)
+{
+       return 1;
+}
+
+static struct ptlrpc_hpreq_ops ptlrpc_hpreq_common = {
+       .hpreq_lock_match  = NULL,
+       .hpreq_check       = ptlrpc_hpreq_check,
+       .hpreq_fini        = NULL,
+};
+
+/* Hi-Priority RPC check by RPC operation code. */
+int ptlrpc_hpreq_handler(struct ptlrpc_request *req)
+{
+       int opc = lustre_msg_get_opc(req->rq_reqmsg);
+
+       /* Check for export to let only reconnects for not yet evicted
+        * export to become a HP rpc. */
+       if ((req->rq_export != NULL) &&
+           (opc == OBD_PING || opc == MDS_CONNECT || opc == OST_CONNECT))
+               req->rq_ops = &ptlrpc_hpreq_common;
+
+       return 0;
+}
+EXPORT_SYMBOL(ptlrpc_hpreq_handler);
+
 /**
  * Make the request a high priority one.
  *
@@ -1527,13 +1553,7 @@ void ptlrpc_hpreq_reorder(struct ptlrpc_request *req)
 static int ptlrpc_server_hpreq_check(struct ptlrpc_service *svc,
                                      struct ptlrpc_request *req)
 {
-        ENTRY;
-
-        /* Check by request opc. */
-        if (OBD_PING == lustre_msg_get_opc(req->rq_reqmsg))
-                RETURN(1);
-
-        RETURN(ptlrpc_hpreq_init(svc, req));
+       return ptlrpc_hpreq_init(svc, req);
 }
 
 /** Check if a request is a high priority one. */