/* If I get here, I've committed to send, so I complete the tx with
* failure on any problems */
- LASSERT (tx->tx_conn == NULL); /* only set when assigned a conn */
- LASSERT (tx->tx_nwrq > 0); /* work items have been set up */
+ LASSERT (tx == NULL || tx->tx_conn == NULL); /* only set when assigned a conn */
+ LASSERT (tx == NULL || tx->tx_nwrq > 0); /* work items have been set up */
/* First time, just use a read lock since I expect to find my peer
* connected */
read_unlock_irqrestore(g_lock, flags);
- kiblnd_queue_tx(tx, conn);
+ if (tx != NULL)
+ kiblnd_queue_tx(tx, conn);
kiblnd_conn_decref(conn); /* ...to here */
return;
}
/* found a peer, but it's still connecting... */
LASSERT (peer->ibp_connecting != 0 ||
peer->ibp_accepting != 0);
- list_add_tail (&tx->tx_list, &peer->ibp_tx_queue);
+ if (tx != NULL)
+ list_add_tail(&tx->tx_list, &peer->ibp_tx_queue);
write_unlock_irqrestore(g_lock, flags);
} else {
conn = kiblnd_get_conn_locked(peer);
kiblnd_conn_addref(conn); /* 1 ref for me... */
write_unlock_irqrestore(g_lock, flags);
-
- kiblnd_queue_tx(tx, conn);
+
+ if (tx != NULL)
+ kiblnd_queue_tx(tx, conn);
kiblnd_conn_decref(conn); /* ...to here */
}
return;
rc = kiblnd_create_peer(ni, &peer, nid);
if (rc != 0) {
CERROR("Can't create peer %s\n", libcfs_nid2str(nid));
- tx->tx_status = -EHOSTUNREACH;
- tx->tx_waiting = 0;
- kiblnd_tx_done(ni, tx);
+ if (tx != NULL) {
+ tx->tx_status = -EHOSTUNREACH;
+ tx->tx_waiting = 0;
+ kiblnd_tx_done(ni, tx);
+ }
return;
}
/* found a peer, but it's still connecting... */
LASSERT (peer2->ibp_connecting != 0 ||
peer2->ibp_accepting != 0);
- list_add_tail (&tx->tx_list, &peer2->ibp_tx_queue);
+ if (tx != NULL)
+ list_add_tail(&tx->tx_list, &peer2->ibp_tx_queue);
write_unlock_irqrestore(g_lock, flags);
} else {
conn = kiblnd_get_conn_locked(peer2);
kiblnd_conn_addref(conn); /* 1 ref for me... */
write_unlock_irqrestore(g_lock, flags);
-
- kiblnd_queue_tx(tx, conn);
+
+ if (tx != NULL)
+ kiblnd_queue_tx(tx, conn);
kiblnd_conn_decref(conn); /* ...to here */
}
/* always called with a ref on ni, which prevents ni being shutdown */
LASSERT (((kib_net_t *)ni->ni_data)->ibn_shutdown == 0);
- list_add_tail(&tx->tx_list, &peer->ibp_tx_queue);
+ if (tx != NULL)
+ list_add_tail(&tx->tx_list, &peer->ibp_tx_queue);
kiblnd_peer_addref(peer);
list_add_tail(&peer->ibp_list, kiblnd_nid2peerlist(nid));