Whamcloud - gitweb
LU-2936 ptlrpc: Do not try to fetch hp request blindly
authorOleg Drokin <green@whamcloud.com>
Sat, 9 Mar 2013 23:44:36 +0000 (18:44 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 13 Mar 2013 06:10:37 +0000 (02:10 -0400)
ptlrpc_svcpt_health_check tries to blindly fetch a hp requet from
any service it happens to be called on, but some services don't have
any hp policies registered resulting in an underlyign assertion
in nrs_svcpt2nrs.
Make sure there are in fact pending hp requests on a service before
attempting to fetch them.

Change-Id: Ia38dcce758db948a1e4c187d009da4a8d5f2cbc6
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/5665
Tested-by: Hudson
Reviewed-by: Nikitas Angelinas <nikitas_angelinas@xyratex.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
lustre/ptlrpc/service.c

index 2f0f3a5..6278f7b 100644 (file)
@@ -3158,23 +3158,24 @@ EXPORT_SYMBOL(ptlrpc_unregister_service);
  * to be shot, so it's intentionally non-aggressive. */
 int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
 {
  * to be shot, so it's intentionally non-aggressive. */
 int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
 {
-       struct ptlrpc_request           *request;
+       struct ptlrpc_request           *request = NULL;
        struct timeval                  right_now;
        long                            timediff;
 
        cfs_gettimeofday(&right_now);
 
        spin_lock(&svcpt->scp_req_lock);
        struct timeval                  right_now;
        long                            timediff;
 
        cfs_gettimeofday(&right_now);
 
        spin_lock(&svcpt->scp_req_lock);
-       if (!ptlrpc_server_request_pending(svcpt, 1)) {
+        /* How long has the next entry been waiting? */
+       if (ptlrpc_server_high_pending(svcpt, 1))
+               request = ptlrpc_nrs_req_poll_nolock(svcpt, true);
+       else if (ptlrpc_server_normal_pending(svcpt, 1))
+               request = ptlrpc_nrs_req_poll_nolock(svcpt, false);
+
+       if (request == NULL) {
                spin_unlock(&svcpt->scp_req_lock);
                return 0;
        }
 
                spin_unlock(&svcpt->scp_req_lock);
                return 0;
        }
 
-        /* How long has the next entry been waiting? */
-       request = ptlrpc_nrs_req_poll_nolock(svcpt, true);
-       if (request == NULL)
-               request = ptlrpc_nrs_req_poll_nolock(svcpt, false);
-
        timediff = cfs_timeval_sub(&right_now, &request->rq_arrival_time, NULL);
        spin_unlock(&svcpt->scp_req_lock);
 
        timediff = cfs_timeval_sub(&right_now, &request->rq_arrival_time, NULL);
        spin_unlock(&svcpt->scp_req_lock);