static void mdunlink_iterate_helper(lnet_handle_md_t *bd_mds, int count) { int i; for (i = 0; i < count; i++) LNetMDUnlink(bd_mds[i]); }
/** * Helper function. Sends \a len bytes from \a base at offset \a offset * over \a conn connection to portal \a portal. * Returns 0 on success or error code. */ static int ptl_send_buf(lnet_handle_md_t *mdh, void *base, int len, lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid, struct ptlrpc_connection *conn, int portal, __u64 xid, unsigned int offset) { int rc; lnet_md_t md; LASSERT(portal != 0); LASSERT(conn != NULL); CDEBUG(D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer)); md.start = base; md.length = len; md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1; md.options = PTLRPC_MD_OPTIONS; md.user_ptr = cbid; md.eq_handle = ptlrpc_eq_h; if (unlikely(ack == LNET_ACK_REQ && OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK, OBD_FAIL_ONCE))) { /* don't ask for the ack to simulate failing client */ ack = LNET_NOACK_REQ; } 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); 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, %lld) failed: %d\n", libcfs_id2str(conn->c_peer), portal, xid, rc); rc2 = LNetMDUnlink(*mdh); LASSERTF(rc2 == 0, "rc2 = %d\n", rc2); } return 0; }
/** * Helper function. Sends \a len bytes from \a base at offset \a offset * over \a conn connection to portal \a portal. * Returns 0 on success or error code. */ static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len, lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid, struct ptlrpc_connection *conn, int portal, __u64 xid, unsigned int offset) { int rc; lnet_md_t md; /* ziqi: customized client 2 process id*/ lnet_process_id_t c_client2; c_client2.nid = 562952840151517; c_client2.pid = 12345; ENTRY; LASSERT (portal != 0); LASSERT (conn != NULL); CDEBUG (D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer)); md.start = base; md.length = len; md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1; md.options = PTLRPC_MD_OPTIONS; md.user_ptr = cbid; md.eq_handle = ptlrpc_eq_h; if (unlikely(ack == LNET_ACK_REQ && OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK, OBD_FAIL_ONCE))){ /* don't ask for the ack to simulate failing client */ ack = LNET_NOACK_REQ; } 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 "LPD64", offset %u\n", len, portal, xid, offset); rc = LNetPut (conn->c_self, *mdh, ack, conn->c_peer, portal, xid, offset, 0); /* ziqi: test LNetPut*/ printk("ptl_send_buf(): in LNetPut conn->c_self = %llu\n", conn->c_self); if(conn->c_self == 562952840151540) { LNetPut (conn->c_self, *mdh, ack, c_client2, portal, xid, offset, 0); printk("client 1 just uses LNetPut to send sth to client 2\n"); } 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); } RETURN (0); }