Whamcloud - gitweb
LU-4181 lnet_selftest: bogus lst errors
[fs/lustre-release.git] / lnet / selftest / rpc.c
index 91c7009..2845bf6 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -54,7 +54,7 @@ typedef enum {
         SRPC_STATE_STOPPING,
 } srpc_state_t;
 
-struct smoketest_rpc {
+static struct smoketest_rpc {
        spinlock_t       rpc_glock;     /* global lock */
        srpc_service_t  *rpc_services[SRPC_SERVICE_MAX_ID + 1];
        lnet_handle_eq_t rpc_lnet_eq;   /* _the_ LNet event queue */
@@ -87,7 +87,7 @@ void srpc_set_counters (const srpc_counters_t *cnt)
        spin_unlock(&srpc_data.rpc_glock);
 }
 
-int
+static int
 srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob)
 {
        nob = min(nob, (int)PAGE_CACHE_SIZE);
@@ -205,7 +205,7 @@ srpc_next_id (void)
        return id;
 }
 
-void
+static void
 srpc_init_server_rpc(struct srpc_server_rpc *rpc,
                     struct srpc_service_cd *scd,
                     struct srpc_buffer *buffer)
@@ -386,7 +386,7 @@ srpc_remove_service (srpc_service_t *sv)
        return 0;
 }
 
-int
+static int
 srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf,
                       int len, int options, lnet_process_id_t peer,
                       lnet_handle_md_t *mdh, srpc_event_t *ev)
@@ -426,7 +426,7 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf,
         return 0;
 }
 
-int
+static int
 srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
                       int options, lnet_process_id_t peer, lnet_nid_t self,
                       lnet_handle_md_t *mdh, srpc_event_t *ev)
@@ -478,7 +478,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
         return 0;
 }
 
-int
+static int
 srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf,
                        int len, lnet_handle_md_t *mdh, srpc_event_t *ev)
 {
@@ -487,7 +487,7 @@ srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf,
                                     LNET_NID_ANY, mdh, ev);
 }
 
-int
+static int
 srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
                         lnet_handle_md_t *mdh, srpc_event_t *ev)
 {
@@ -501,7 +501,7 @@ srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
                                      LNET_MD_OP_PUT, any, mdh, ev);
 }
 
-int
+static int
 srpc_service_post_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf)
 __must_hold(&scd->scd_lock)
 {
@@ -733,7 +733,7 @@ srpc_finish_service(struct srpc_service *sv)
 }
 
 /* called with sv->sv_lock held */
-void
+static void
 srpc_service_recycle_buffer(struct srpc_service_cd *scd, srpc_buffer_t *buf)
 __must_hold(&scd->scd_lock)
 {
@@ -824,7 +824,7 @@ srpc_shutdown_service(srpc_service_t *sv)
        }
 }
 
-int
+static int
 srpc_send_request (srpc_client_rpc_t *rpc)
 {
         srpc_event_t *ev = &rpc->crpc_reqstev;
@@ -844,7 +844,7 @@ srpc_send_request (srpc_client_rpc_t *rpc)
         return rc;
 }
 
-int
+static int
 srpc_prepare_reply (srpc_client_rpc_t *rpc)
 {
         srpc_event_t *ev = &rpc->crpc_replyev;
@@ -868,7 +868,7 @@ srpc_prepare_reply (srpc_client_rpc_t *rpc)
         return rc;
 }
 
-int
+static int
 srpc_prepare_bulk (srpc_client_rpc_t *rpc)
 {
         srpc_bulk_t  *bk = &rpc->crpc_bulk;
@@ -904,7 +904,7 @@ srpc_prepare_bulk (srpc_client_rpc_t *rpc)
         return rc;
 }
 
-int
+static int
 srpc_do_bulk (srpc_server_rpc_t *rpc)
 {
         srpc_event_t  *ev = &rpc->srpc_ev;
@@ -936,7 +936,7 @@ srpc_do_bulk (srpc_server_rpc_t *rpc)
 }
 
 /* only called from srpc_handle_rpc */
-void
+static void
 srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status)
 {
        struct srpc_service_cd  *scd = rpc->srpc_scd;
@@ -1111,7 +1111,7 @@ srpc_handle_rpc(swi_workitem_t *wi)
         return 0;
 }
 
-void
+static void
 srpc_client_rpc_expired (void *data)
 {
         srpc_client_rpc_t *rpc = data;
@@ -1132,7 +1132,7 @@ srpc_client_rpc_expired (void *data)
        spin_unlock(&srpc_data.rpc_glock);
 }
 
-inline void
+static void
 srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc)
 {
        stt_timer_t *timer = &rpc->crpc_timer;
@@ -1154,7 +1154,7 @@ srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc)
  *
  * Upon exit the RPC expiry timer is not queued and the handler is not
  * running on any CPU. */
-void
+static void
 srpc_del_client_rpc_timer (srpc_client_rpc_t *rpc)
 {
        /* timer not planted or already exploded */
@@ -1179,7 +1179,7 @@ srpc_del_client_rpc_timer (srpc_client_rpc_t *rpc)
 #endif
 }
 
-void
+static void
 srpc_client_rpc_done (srpc_client_rpc_t *rpc, int status)
 {
        swi_workitem_t *wi = &rpc->crpc_wi;
@@ -1443,7 +1443,7 @@ srpc_send_reply(struct srpc_server_rpc *rpc)
 }
 
 /* when in kernel always called with LNET_LOCK() held, and in thread context */
-void
+static void
 srpc_lnet_ev_handler(lnet_event_t *ev)
 {
        struct srpc_service_cd  *scd;
@@ -1458,9 +1458,16 @@ srpc_lnet_ev_handler(lnet_event_t *ev)
        LASSERT (!in_interrupt());
 
        if (ev->status != 0) {
+               __u32 errors;
+
                spin_lock(&srpc_data.rpc_glock);
-               srpc_data.rpc_counters.errors++;
+               if (ev->status != -ECANCELED) /* cancellation is not error */
+                       srpc_data.rpc_counters.errors++;
+               errors = srpc_data.rpc_counters.errors;
                spin_unlock(&srpc_data.rpc_glock);
+
+               CNETERR("LNet event status %d type %d, RPC errors %u\n",
+                       ev->status, ev->type, errors);
        }
 
         rpcev->ev_lnet = ev->type;