Whamcloud - gitweb
* GMNAL
[fs/lustre-release.git] / lnet / klnds / openiblnd / openiblnd.c
index adc5ba8..d0385a6 100644 (file)
@@ -800,7 +800,7 @@ kibnal_stop_ip_listener(int clear_acceptq)
         down(&kibnal_data.kib_listener_signal);
 
         LASSERT (kibnal_data.kib_listener_sock == NULL);
-        CDEBUG(D_WARNING, "Listener stopped\n");
+        CWARN("Listener stopped\n");
 
         if (!clear_acceptq)
                 return;
@@ -821,9 +821,15 @@ kibnal_stop_ip_listener(int clear_acceptq)
         }
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
 int 
 kibnal_listener_procint(ctl_table *table, int write, struct file *filp,
                         void *buffer, size_t *lenp)
+#else
+int 
+kibnal_listener_procint(ctl_table *table, int write, struct file *filp,
+                        void *buffer, size_t *lenp, loff_t *ppos)
+#endif
 {
         int   *tunable = (int *)table->data;
         int    old_val;
@@ -839,8 +845,11 @@ kibnal_listener_procint(ctl_table *table, int write, struct file *filp,
                  tunable == &kibnal_tunables.kib_backlog);
         old_val = *tunable;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
         rc = proc_dointvec(table, write, filp, buffer, lenp);
-
+#else
+        rc = proc_dointvec(table, write, filp, buffer, lenp, ppos);
+#endif
         if (write &&
             (*tunable != old_val ||
              kibnal_data.kib_listener_sock == NULL)) {
@@ -1001,6 +1010,7 @@ kibnal_create_peer (ptl_nid_t nid)
         INIT_LIST_HEAD (&peer->ibp_list);       /* not in the peer table yet */
         INIT_LIST_HEAD (&peer->ibp_conns);
         INIT_LIST_HEAD (&peer->ibp_tx_queue);
+        INIT_LIST_HEAD (&peer->ibp_connd_list); /* not queued for connecting */
 
         peer->ibp_reconnect_time = jiffies;
         peer->ibp_reconnect_interval = IBNAL_MIN_RECONNECT_INTERVAL;
@@ -1020,6 +1030,7 @@ kibnal_destroy_peer (kib_peer_t *peer)
         LASSERT (peer->ibp_persistence == 0);
         LASSERT (!kibnal_peer_active(peer));
         LASSERT (peer->ibp_connecting == 0);
+        LASSERT (list_empty (&peer->ibp_connd_list));
         LASSERT (list_empty (&peer->ibp_conns));
         LASSERT (list_empty (&peer->ibp_tx_queue));
 
@@ -1075,12 +1086,13 @@ kib_peer_t *
 kibnal_get_peer (ptl_nid_t nid)
 {
         kib_peer_t     *peer;
+        unsigned long   flags;
 
-        read_lock (&kibnal_data.kib_global_lock);
+        read_lock_irqsave(&kibnal_data.kib_global_lock, flags);
         peer = kibnal_find_peer_locked (nid);
         if (peer != NULL)                       /* +1 ref for caller? */
                 atomic_inc (&peer->ibp_refcount);
-        read_unlock (&kibnal_data.kib_global_lock);
+        read_unlock_irqrestore(&kibnal_data.kib_global_lock, flags);
 
         return (peer);
 }
@@ -1103,9 +1115,10 @@ kibnal_get_peer_info (int index, ptl_nid_t *nidp, __u32 *ipp, int *portp,
 {
         kib_peer_t        *peer;
         struct list_head  *ptmp;
+        unsigned long      flags;
         int                i;
 
-        read_lock (&kibnal_data.kib_global_lock);
+        read_lock_irqsave(&kibnal_data.kib_global_lock, flags);
 
         for (i = 0; i < kibnal_data.kib_peer_hash_size; i++) {
 
@@ -1124,12 +1137,13 @@ kibnal_get_peer_info (int index, ptl_nid_t *nidp, __u32 *ipp, int *portp,
                         *portp = peer->ibp_port;
                         *persistencep = peer->ibp_persistence;
                         
-                        read_unlock (&kibnal_data.kib_global_lock);
+                        read_unlock_irqrestore(&kibnal_data.kib_global_lock,
+                                               flags);
                         return (0);
                 }
         }
 
-        read_unlock (&kibnal_data.kib_global_lock);
+        read_unlock_irqrestore(&kibnal_data.kib_global_lock, flags);
         return (-ENOENT);
 }
 
@@ -1248,9 +1262,10 @@ kibnal_get_conn_by_idx (int index)
         struct list_head  *ptmp;
         kib_conn_t        *conn;
         struct list_head  *ctmp;
+        unsigned long      flags;
         int                i;
 
-        read_lock (&kibnal_data.kib_global_lock);
+        read_lock_irqsave(&kibnal_data.kib_global_lock, flags);
 
         for (i = 0; i < kibnal_data.kib_peer_hash_size; i++) {
                 list_for_each (ptmp, &kibnal_data.kib_peers[i]) {
@@ -1269,13 +1284,14 @@ kibnal_get_conn_by_idx (int index)
                                        conn, conn->ibc_state, conn->ibc_peer->ibp_nid,
                                        atomic_read (&conn->ibc_refcount));
                                 atomic_inc (&conn->ibc_refcount);
-                                read_unlock (&kibnal_data.kib_global_lock);
+                                read_unlock_irqrestore(&kibnal_data.kib_global_lock,
+                                                       flags);
                                 return (conn);
                         }
                 }
         }
 
-        read_unlock (&kibnal_data.kib_global_lock);
+        read_unlock_irqrestore(&kibnal_data.kib_global_lock, flags);
         return (NULL);
 }
 
@@ -1505,7 +1521,8 @@ kibnal_close_stale_conns_locked (kib_peer_t *peer, __u64 incarnation)
                 if (conn->ibc_incarnation == incarnation)
                         continue;
 
-                CDEBUG(D_NET, "Closing stale conn nid:"LPX64" incarnation:"LPX64"("LPX64")\n",
+                CDEBUG(D_NET, "Closing stale conn %p nid:"LPX64
+                       " incarnation:"LPX64"("LPX64")\n", conn,
                        peer->ibp_nid, conn->ibc_incarnation, incarnation);
                 
                 count++;