Whamcloud - gitweb
b=21828 drop number of active requests when queued for recovery
authorDmitry Zogin <dmitry.zogin@sun.com>
Wed, 20 Jan 2010 23:54:49 +0000 (18:54 -0500)
committerJohann Lombardi <johann@sun.com>
Thu, 21 Jan 2010 10:37:55 +0000 (11:37 +0100)
Now that we take a reference on the original request instead of
making a copy of it for recovery.  We need to drop the number of
active requests or the queued requests will prevent all request
processing when they exceed (srv->srv_threads_running - 1).

 i=nathan.rutman
 i=tappro

lustre/include/lustre_net.h
lustre/ldlm/ldlm_lib.c
lustre/ptlrpc/service.c

index 3e90a48..60a96c0 100644 (file)
@@ -907,6 +907,8 @@ int liblustre_check_services (void *arg);
 void ptlrpc_daemonize(char *name);
 int ptlrpc_service_health_check(struct ptlrpc_service *);
 void ptlrpc_hpreq_reorder(struct ptlrpc_request *req);
+void ptlrpc_server_active_request_inc(struct ptlrpc_request *req);
+void ptlrpc_server_active_request_dec(struct ptlrpc_request *req);
 void ptlrpc_server_drop_request(struct ptlrpc_request *req);
 
 
index 34fcdaa..1f1c2d4 100644 (file)
@@ -1173,6 +1173,10 @@ static void target_request_copy_get(struct ptlrpc_request *req)
         req->rq_copy_queued = 1;
         /* increase refcount to keep request in queue */
         atomic_inc(&req->rq_refcount);
+        /* release service thread while request is queued
+         * we are moving the request from active processing
+         * to waiting on the replay queue */
+        ptlrpc_server_active_request_dec(req);
 }
 
 static void target_request_copy_put(struct ptlrpc_request *req)
@@ -1184,6 +1188,8 @@ static void target_request_copy_put(struct ptlrpc_request *req)
          */
         LASSERT(req->rq_copy_queued);
         class_export_rpc_put(req->rq_export);
+        /* ptlrpc_server_drop_request() assumes the request is active */
+        ptlrpc_server_active_request_inc(req);
         ptlrpc_server_drop_request(req);
 }
 
index 778b376..6b107a3 100644 (file)
@@ -425,6 +425,32 @@ static void ptlrpc_server_free_request(struct ptlrpc_request *req)
 }
 
 /**
+ * increment the number of active requests consuming service threads.
+ */
+void ptlrpc_server_active_request_inc(struct ptlrpc_request *req)
+{
+        struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd;
+        struct ptlrpc_service *svc = rqbd->rqbd_service;
+
+        spin_lock(&svc->srv_lock);
+        svc->srv_n_active_reqs++;
+        spin_unlock(&svc->srv_lock);
+}
+
+/**
+ * decrement the number of active requests consuming service threads.
+ */
+void ptlrpc_server_active_request_dec(struct ptlrpc_request *req)
+{
+        struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd;
+        struct ptlrpc_service *svc = rqbd->rqbd_service;
+
+        spin_lock(&svc->srv_lock);
+        svc->srv_n_active_reqs--;
+        spin_unlock(&svc->srv_lock);
+}
+
+/**
  * drop a reference count of the request. if it reaches 0, we either
  * put it into history list, or free it immediately.
  */