Whamcloud - gitweb
LU-12930 various: use schedule_timeout_*interruptible
[fs/lustre-release.git] / lnet / klnds / gnilnd / gnilnd_stack.c
index 6268f31..456d181 100644 (file)
@@ -133,8 +133,7 @@ kgnilnd_quiesce_wait(char *reason)
                                 atomic_read(&kgnilnd_data.kgn_nthreads) -
                                 atomic_read(&kgnilnd_data.kgn_nquiesce));
                        CFS_RACE(CFS_FAIL_GNI_QUIESCE_RACE);
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(cfs_time_seconds(1 * i));
+                       schedule_timeout_uninterruptible(cfs_time_seconds(i));
 
                        LASSERTF(quiesce_deadline > jiffies,
                                 "couldn't quiesce threads in %lu seconds, falling over now\n",
@@ -159,8 +158,7 @@ kgnilnd_quiesce_wait(char *reason)
                                 "%s: Waiting for %d threads to wake up\n",
                                  reason,
                                  atomic_read(&kgnilnd_data.kgn_nquiesce));
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(cfs_time_seconds(1 * i));
+                       schedule_timeout_uninterruptible(cfs_time_seconds(i));
                }
 
                CDEBUG(D_INFO, "%s: All threads awake!\n", reason);
@@ -254,6 +252,9 @@ kgnilnd_reset_stack(void)
 
                        list_del_init(&conn->gnc_schedlist);
 
+                       if (!list_empty(&conn->gnc_delaylist))
+                               list_del_init(&conn->gnc_delaylist); 
+
                        if (conn->gnc_state == GNILND_CONN_CLOSING) {
                                /* bump to CLOSED to fake out send of CLOSE */
                                conn->gnc_state = GNILND_CONN_CLOSED;
@@ -419,8 +420,8 @@ kgnilnd_ruhroh_thread(void *arg)
                                i++;
                                CDEBUG(D_INFO, "Waiting for hardware quiesce "
                                               "flag to clear\n");
-                               set_current_state(TASK_UNINTERRUPTIBLE);
-                               schedule_timeout(cfs_time_seconds(1 * i));
+                               schedule_timeout_uninterruptible(
+                                       cfs_time_seconds(i));
 
                                /* If we got a quiesce event with bump info, DO THE BUMP!. */
                                if (kgnilnd_data.kgn_bump_info_rdy) {
@@ -581,10 +582,9 @@ struct rcadata {
        rs_event_code_t ec;
 };
 static struct rcadata rd[RCA_EVENTS] = {
-       {0, 0, ec_node_unavailable},
-       {0, 0, ec_node_available},
-       {0, 0, ec_node_failed}
-};
+       { .ec = ec_node_unavailable },
+       { .ec = ec_node_available },
+       { .ec = ec_node_failed } };
 
 /* thread for receiving rca events */
 int
@@ -651,7 +651,7 @@ subscribe_retry:
                }
 
                if (krca_get_message(&rca_krt, &event) == 0) {
-                       int node_down = GNILND_RCA_NODE_UNKNOWN;
+                       int node_down = GNILND_PEER_UNKNOWN;
                        rs_state_t state;
                        LIST_HEAD(zombies);
 
@@ -675,7 +675,7 @@ subscribe_retry:
                        switch (event.ev_id) {
                        case ec_node_available:
                                CDEBUG(D_INFO, "ec_node_available\n");
-                               node_down = GNILND_RCA_NODE_UP;
+                               node_down = GNILND_PEER_UP;
                                break;
                        case ec_node_failed:
                                CDEBUG(D_INFO, "ec_node_failed\n");
@@ -684,7 +684,7 @@ subscribe_retry:
                                                "ec_node_failed ignored\n");
                                        break;
                                }
-                               node_down = GNILND_RCA_NODE_DOWN;
+                               node_down = GNILND_PEER_DOWN;
                                break;
                        case ec_node_unavailable:
                                state = RSN_GET_FLD(event.ev_gen.svid_node.rsn_intval, STATE);
@@ -701,7 +701,7 @@ subscribe_retry:
                                                " RS_CS_READY state\n");
                                        break;
                                }
-                               node_down = GNILND_RCA_NODE_DOWN;
+                               node_down = GNILND_PEER_DOWN;
                                break;
                        default:
                                CDEBUG(D_INFO, "unknown event\n");
@@ -710,9 +710,8 @@ subscribe_retry:
 
                        /* if we get an event we don't know about, just go ahead
                         * and wait for another event */
-                       if (node_down == GNILND_RCA_NODE_UNKNOWN) {
+                       if (node_down == GNILND_PEER_UNKNOWN)
                                continue;
-                       }
 
                        nid = RSN_GET_FLD(event.ev_gen.svid_node.rs_node_flat,
                                          NID);
@@ -768,7 +767,7 @@ int
 kgnilnd_get_node_state(__u32 nid)
 {
        int i;
-       int rc = GNILND_RCA_NODE_UNKNOWN;
+       int rc = GNILND_PEER_UNKNOWN;
        int ret;
        rs_node_array_t nlist;
        rs_node_t       *na = NULL;
@@ -783,7 +782,7 @@ kgnilnd_get_node_state(__u32 nid)
        for (i = 0; i < nlist.na_len; i++) {
                if ((rca_nid_t)RSN_GET_FLD(na[i].rs_node_flat, NID) == nid) {
                        rc = RSN_GET_FLD(na[i].rs_node_flat, STATE) == RS_CS_READY ?
-                               GNILND_RCA_NODE_UP : GNILND_RCA_NODE_DOWN;
+                               GNILND_PEER_UP : GNILND_PEER_DOWN;
                        break;
                }
        }
@@ -810,6 +809,6 @@ kgnilnd_wakeup_rca_thread(void)
 int
 kgnilnd_get_node_state(__u32 nid)
 {
-       return GNILND_RCA_NODE_UP;
+       return GNILND_PEER_UP;
 }
 #endif /* GNILND_USE_RCA */