- CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64", offset %u\n",
- len, portal, xid, offset);
-
- rc = LNetPut (conn->c_self, *mdh, ack,
- conn->c_peer, portal, xid, offset, 0);
- if (unlikely(rc != 0)) {
- int rc2;
- /* We're going to get an UNLINK event when I unlink below,
- * which will complete just like any other failed send, so
- * I fall through and return success here! */
- CERROR("LNetPut(%s, %d, "LPD64") failed: %d\n",
- libcfs_id2str(conn->c_peer), portal, xid, rc);
- rc2 = LNetMDUnlink(*mdh);
- LASSERTF(rc2 == 0, "rc2 = %d\n", rc2);
- }
+ rc = LNetMDBind(&md, LNET_UNLINK, mdh);
+ if (unlikely(rc != 0)) {
+ CERROR ("LNetMDBind failed: %d\n", rc);
+ LASSERT (rc == -ENOMEM);
+ RETURN (-ENOMEM);
+ }
+
+ CDEBUG(D_NET, "Sending %d bytes to portal %d, xid %lld, offset %u\n",
+ len, portal, xid, offset);
+
+ percpu_ref_get(&ptlrpc_pending);
+
+ rc = LNetPut(self, *mdh, ack,
+ peer_id, portal, xid, offset, 0);
+ if (unlikely(rc != 0)) {
+ int rc2;
+ /* We're going to get an UNLINK event when I unlink below,
+ * which will complete just like any other failed send, so
+ * I fall through and return success here! */
+ CERROR("LNetPut(%s, %d, %lld) failed: %d\n",
+ libcfs_id2str(peer_id), portal, xid, rc);
+ rc2 = LNetMDUnlink(*mdh);
+ LASSERTF(rc2 == 0, "rc2 = %d\n", rc2);
+ }