Whamcloud - gitweb
b=21828 drop number of active requests when queued for recovery
authorDmitry Zogin <dmitry.zogin@sun.com>
Mon, 25 Jan 2010 05:15:53 +0000 (00:15 -0500)
committerRobert Read <rread@sun.com>
Mon, 25 Jan 2010 18:49:10 +0000 (10:49 -0800)
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=nathaniel.ruthman
i=tappro

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

index dbb4a9f..a1fd22e 100644 (file)
@@ -1078,6 +1078,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);
 
 #ifdef __KERNEL__
index 350f3a9..a722ff2 100644 (file)
@@ -1116,6 +1116,10 @@ static void target_request_copy_get(struct ptlrpc_request *req)
         cfs_atomic_inc(&req->rq_refcount);
         /** let export know it has replays to be handled */
         cfs_atomic_inc(&req->rq_export->exp_replay_count);
+        /* 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)
@@ -1124,6 +1128,8 @@ static void target_request_copy_put(struct ptlrpc_request *req)
         LASSERT(cfs_atomic_read(&req->rq_export->exp_replay_count) > 0);
         cfs_atomic_dec(&req->rq_export->exp_replay_count);
         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 a38c511..73aff1b 100644 (file)
@@ -599,6 +599,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;
+
+        cfs_spin_lock(&svc->srv_lock);
+        svc->srv_n_active_reqs++;
+        cfs_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;
+
+        cfs_spin_lock(&svc->srv_lock);
+        svc->srv_n_active_reqs--;
+        cfs_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.
  */