Whamcloud - gitweb
b=21911 fix for double release of ibc_lock in o2iblnd
authorMaxim Patlasov <Maxim.Patlasov@Sun.COM>
Thu, 25 Feb 2010 12:39:51 +0000 (15:39 +0300)
committerJohann Lombardi <johann@sun.com>
Thu, 25 Feb 2010 12:54:50 +0000 (13:54 +0100)
i=liang
Re-acquire ibc_lock in kiblnd_post_tx_locked(). Add extra reference to conn before calling kiblnd_post_tx_locked() to avoid scenario when conn disappears inside kiblnd_post_tx_locked().

lnet/klnds/o2iblnd/o2iblnd_cb.c

index e7444cd..638ffc5 100644 (file)
@@ -871,6 +871,9 @@ kiblnd_post_tx_locked (kib_conn_t *conn, kib_tx_t *tx, int credit)
 
         if (done)
                 kiblnd_tx_done(peer->ibp_ni, tx);
+
+        spin_lock(&conn->ibc_lock);
+
         return -EIO;
 }
 
@@ -916,6 +919,8 @@ kiblnd_check_sends (kib_conn_t *conn)
                         kiblnd_queue_tx_locked(tx, conn);
         }
 
+        kiblnd_conn_addref(conn); /* 1 ref for me.... (see b21911) */
+
         for (;;) {
                 int credit;
 
@@ -935,6 +940,8 @@ kiblnd_check_sends (kib_conn_t *conn)
         }
 
         spin_unlock(&conn->ibc_lock);
+
+        kiblnd_conn_decref(conn); /* ...until here */
 }
 
 void