1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37#define DEBUG_SUBSYSTEM S_RPC
38#include <obd_support.h>
39#include <lustre_net.h>
40#include <lustre_lib.h>
41#include <obd.h>
42#include <obd_class.h>
43#include "ptlrpc_internal.h"
44
45
46
47
48
49
50static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len,
51 lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid,
52 struct ptlrpc_connection *conn, int portal, __u64 xid,
53 unsigned int offset)
54{
55 int rc;
56 lnet_md_t md;
57
58 LASSERT (portal != 0);
59 LASSERT (conn != NULL);
60 CDEBUG (D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer));
61 md.start = base;
62 md.length = len;
63 md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1;
64 md.options = PTLRPC_MD_OPTIONS;
65 md.user_ptr = cbid;
66 md.eq_handle = ptlrpc_eq_h;
67
68 if (unlikely(ack == LNET_ACK_REQ &&
69 OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK, OBD_FAIL_ONCE))){
70
71 ack = LNET_NOACK_REQ;
72 }
73
74 rc = LNetMDBind (md, LNET_UNLINK, mdh);
75 if (unlikely(rc != 0)) {
76 CERROR ("LNetMDBind failed: %d\n", rc);
77 LASSERT (rc == -ENOMEM);
78 return -ENOMEM;
79 }
80
81 CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64", offset %u\n",
82 len, portal, xid, offset);
83
84 rc = LNetPut (conn->c_self, *mdh, ack,
85 conn->c_peer, portal, xid, offset, 0);
86 if (unlikely(rc != 0)) {
87 int rc2;
88
89
90
91 CERROR("LNetPut(%s, %d, "LPD64") failed: %d\n",
92 libcfs_id2str(conn->c_peer), portal, xid, rc);
93 rc2 = LNetMDUnlink(*mdh);
94 LASSERTF(rc2 == 0, "rc2 = %d\n", rc2);
95 }
96
97 return 0;
98}
99
100static void mdunlink_iterate_helper(lnet_handle_md_t *bd_mds, int count)
101{
102 int i;
103
104 for (i = 0; i < count; i++)
105 LNetMDUnlink(bd_mds[i]);
106}
107
108
109
110
111
112
113int ptlrpc_register_bulk(struct ptlrpc_request *req)
114{
115 struct ptlrpc_bulk_desc *desc = req->rq_bulk;
116 lnet_process_id_t peer;
117 int rc = 0;
118 int rc2;
119 int posted_md;
120 int total_md;
121 __u64 xid;
122 lnet_handle_me_t me_h;
123 lnet_md_t md;
124
125 if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_GET_NET))
126 return 0;
127
128
129 LASSERT(desc->bd_nob > 0);
130 LASSERT(desc->bd_md_count == 0);
131 LASSERT(desc->bd_md_max_brw <= PTLRPC_BULK_OPS_COUNT);
132 LASSERT(desc->bd_iov_count <= PTLRPC_MAX_BRW_PAGES);
133 LASSERT(desc->bd_req != NULL);
134 LASSERT(desc->bd_type == BULK_PUT_SINK ||
135 desc->bd_type == BULK_GET_SOURCE);
136
137
138 if (req->rq_resend || req->rq_send_state == LUSTRE_IMP_REPLAY)
139 desc->bd_nob_transferred = 0;
140 else
141 LASSERT(desc->bd_nob_transferred == 0);
142
143 desc->bd_failure = 0;
144
145 peer = desc->bd_import->imp_connection->c_peer;
146
147 LASSERT(desc->bd_cbid.cbid_fn == client_bulk_callback);
148 LASSERT(desc->bd_cbid.cbid_arg == desc);
149
150
151
152
153
154
155
156
157 xid = req->rq_xid & ~((__u64)desc->bd_md_max_brw - 1);
158 LASSERTF(!(desc->bd_registered &&
159 req->rq_send_state != LUSTRE_IMP_REPLAY) ||
160 xid != desc->bd_last_xid,
161 "registered: %d rq_xid: "LPU64" bd_last_xid: "LPU64"\n",
162 desc->bd_registered, xid, desc->bd_last_xid);
163
164 total_md = (desc->bd_iov_count + LNET_MAX_IOV - 1) / LNET_MAX_IOV;
165 desc->bd_registered = 1;
166 desc->bd_last_xid = xid;
167 desc->bd_md_count = total_md;
168 md.user_ptr = &desc->bd_cbid;
169 md.eq_handle = ptlrpc_eq_h;
170 md.threshold = 1;
171
172 for (posted_md = 0; posted_md < total_md; posted_md++, xid++) {
173 md.options = PTLRPC_MD_OPTIONS |
174 ((desc->bd_type == BULK_GET_SOURCE) ?
175 LNET_MD_OP_GET : LNET_MD_OP_PUT);
176 ptlrpc_fill_bulk_md(&md, desc, posted_md);
177
178 rc = LNetMEAttach(desc->bd_portal, peer, xid, 0,
179 LNET_UNLINK, LNET_INS_AFTER, &me_h);
180 if (rc != 0) {
181 CERROR("%s: LNetMEAttach failed x"LPU64"/%d: rc = %d\n",
182 desc->bd_export->exp_obd->obd_name, xid,
183 posted_md, rc);
184 break;
185 }
186
187
188 rc = LNetMDAttach(me_h, md, LNET_UNLINK,
189 &desc->bd_mds[posted_md]);
190 if (rc != 0) {
191 CERROR("%s: LNetMDAttach failed x"LPU64"/%d: rc = %d\n",
192 desc->bd_export->exp_obd->obd_name, xid,
193 posted_md, rc);
194 rc2 = LNetMEUnlink(me_h);
195 LASSERT(rc2 == 0);
196 break;
197 }
198 }
199
200 if (rc != 0) {
201 LASSERT(rc == -ENOMEM);
202 spin_lock(&desc->bd_lock);
203 desc->bd_md_count -= total_md - posted_md;
204 spin_unlock(&desc->bd_lock);
205 LASSERT(desc->bd_md_count >= 0);
206 mdunlink_iterate_helper(desc->bd_mds, desc->bd_md_max_brw);
207 req->rq_status = -ENOMEM;
208 return -ENOMEM;
209 }
210
211
212
213 req->rq_xid = --xid;
214 LASSERTF(desc->bd_last_xid == (req->rq_xid & PTLRPC_BULK_OPS_MASK),
215 "bd_last_xid = x"LPU64", rq_xid = x"LPU64"\n",
216 desc->bd_last_xid, req->rq_xid);
217
218 spin_lock(&desc->bd_lock);
219
220 if (desc->bd_md_count != total_md)
221 CWARN("%s: Peer %s touched %d buffers while I registered\n",
222 desc->bd_export->exp_obd->obd_name, libcfs_id2str(peer),
223 total_md - desc->bd_md_count);
224 spin_unlock(&desc->bd_lock);
225
226 CDEBUG(D_NET, "Setup %u bulk %s buffers: %u pages %u bytes, "
227 "xid x"LPX64"-"LPX64", portal %u\n", desc->bd_md_count,
228 desc->bd_type == BULK_GET_SOURCE ? "get-source" : "put-sink",
229 desc->bd_iov_count, desc->bd_nob,
230 desc->bd_last_xid, req->rq_xid, desc->bd_portal);
231
232 return 0;
233}
234EXPORT_SYMBOL(ptlrpc_register_bulk);
235
236
237
238
239
240
241
242int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)
243{
244 struct ptlrpc_bulk_desc *desc = req->rq_bulk;
245 wait_queue_head_t *wq;
246 struct l_wait_info lwi;
247 int rc;
248
249 LASSERT(!in_interrupt());
250
251
252 if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_BULK_UNLINK) &&
253 async && req->rq_bulk_deadline == 0)
254 req->rq_bulk_deadline = cfs_time_current_sec() + LONG_UNLINK;
255
256 if (ptlrpc_client_bulk_active(req) == 0)
257 return 1;
258
259 LASSERT(desc->bd_req == req);
260
261
262
263
264
265 mdunlink_iterate_helper(desc->bd_mds, desc->bd_md_max_brw);
266
267 if (ptlrpc_client_bulk_active(req) == 0)
268 return 1;
269
270
271 ptlrpc_rqphase_move(req, RQ_PHASE_UNREGISTERING);
272
273
274 if (async)
275 return 0;
276
277 if (req->rq_set != NULL)
278 wq = &req->rq_set->set_waitq;
279 else
280 wq = &req->rq_reply_waitq;
281
282 for (;;) {
283
284
285 lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK),
286 cfs_time_seconds(1), NULL, NULL);
287 rc = l_wait_event(*wq, !ptlrpc_client_bulk_active(req), &lwi);
288 if (rc == 0) {
289 ptlrpc_rqphase_move(req, req->rq_next_phase);
290 return 1;
291 }
292
293 LASSERT(rc == -ETIMEDOUT);
294 DEBUG_REQ(D_WARNING, req, "Unexpectedly long timeout: desc %p",
295 desc);
296 }
297 return 0;
298}
299EXPORT_SYMBOL(ptlrpc_unregister_bulk);
300
301static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags)
302{
303 struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
304 struct ptlrpc_service *svc = svcpt->scp_service;
305 int service_time = max_t(int, cfs_time_current_sec() -
306 req->rq_arrival_time.tv_sec, 1);
307
308 if (!(flags & PTLRPC_REPLY_EARLY) &&
309 (req->rq_type != PTL_RPC_MSG_ERR) &&
310 (req->rq_reqmsg != NULL) &&
311 !(lustre_msg_get_flags(req->rq_reqmsg) &
312 (MSG_RESENT | MSG_REPLAY |
313 MSG_REQ_REPLAY_DONE | MSG_LOCK_REPLAY_DONE))) {
314
315
316 int oldse = at_measured(&svcpt->scp_at_estimate, service_time);
317
318 if (oldse != 0) {
319 DEBUG_REQ(D_ADAPTTO, req,
320 "svc %s changed estimate from %d to %d",
321 svc->srv_name, oldse,
322 at_get(&svcpt->scp_at_estimate));
323 }
324 }
325
326 lustre_msg_set_service_time(req->rq_repmsg, service_time);
327
328
329
330 if (req->rq_type == PTL_RPC_MSG_ERR &&
331 (req->rq_export == NULL || req->rq_export->exp_obd->obd_recovering))
332 lustre_msg_set_timeout(req->rq_repmsg, 0);
333 else
334 lustre_msg_set_timeout(req->rq_repmsg,
335 at_get(&svcpt->scp_at_estimate));
336
337 if (req->rq_reqmsg &&
338 !(lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)) {
339 CDEBUG(D_ADAPTTO, "No early reply support: flags=%#x "
340 "req_flags=%#x magic=%d:%x/%x len=%d\n",
341 flags, lustre_msg_get_flags(req->rq_reqmsg),
342 lustre_msg_is_v1(req->rq_reqmsg),
343 lustre_msg_get_magic(req->rq_reqmsg),
344 lustre_msg_get_magic(req->rq_repmsg), req->rq_replen);
345 }
346}
347
348
349
350
351
352
353int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)
354{
355 struct ptlrpc_reply_state *rs = req->rq_reply_state;
356 struct ptlrpc_connection *conn;
357 int rc;
358
359
360
361
362
363
364
365
366 LASSERT (req->rq_no_reply == 0);
367 LASSERT (req->rq_reqbuf != NULL);
368 LASSERT (rs != NULL);
369 LASSERT ((flags & PTLRPC_REPLY_MAYBE_DIFFICULT) || !rs->rs_difficult);
370 LASSERT (req->rq_repmsg != NULL);
371 LASSERT (req->rq_repmsg == rs->rs_msg);
372 LASSERT (rs->rs_cb_id.cbid_fn == reply_out_callback);
373 LASSERT (rs->rs_cb_id.cbid_arg == rs);
374
375
376
377 if (unlikely(req->rq_export && req->rq_export->exp_obd &&
378 req->rq_export->exp_obd->obd_fail)) {
379
380 req->rq_type = PTL_RPC_MSG_ERR;
381 req->rq_status = -ENODEV;
382 CDEBUG(D_HA, "sending ENODEV from failed obd %d\n",
383 req->rq_export->exp_obd->obd_minor);
384 }
385
386
387
388
389
390
391
392
393 req->rq_replen = lustre_shrink_msg(req->rq_repmsg, 0,
394 sizeof(struct ptlrpc_body_v2), 1);
395
396 if (req->rq_type != PTL_RPC_MSG_ERR)
397 req->rq_type = PTL_RPC_MSG_REPLY;
398
399 lustre_msg_set_type(req->rq_repmsg, req->rq_type);
400 lustre_msg_set_status(req->rq_repmsg,
401 ptlrpc_status_hton(req->rq_status));
402 lustre_msg_set_opc(req->rq_repmsg,
403 req->rq_reqmsg ? lustre_msg_get_opc(req->rq_reqmsg) : 0);
404
405 target_pack_pool_reply(req);
406
407 ptlrpc_at_set_reply(req, flags);
408
409 if (req->rq_export == NULL || req->rq_export->exp_connection == NULL)
410 conn = ptlrpc_connection_get(req->rq_peer, req->rq_self, NULL);
411 else
412 conn = ptlrpc_connection_addref(req->rq_export->exp_connection);
413
414 if (unlikely(conn == NULL)) {
415 CERROR("not replying on NULL connection\n");
416 return -ENOTCONN;
417 }
418 ptlrpc_rs_addref(rs);
419
420 rc = sptlrpc_svc_wrap_reply(req);
421 if (unlikely(rc))
422 goto out;
423
424 req->rq_sent = cfs_time_current_sec();
425
426 rc = ptl_send_buf (&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len,
427 (rs->rs_difficult && !rs->rs_no_ack) ?
428 LNET_ACK_REQ : LNET_NOACK_REQ,
429 &rs->rs_cb_id, conn,
430 ptlrpc_req2svc(req)->srv_rep_portal,
431 req->rq_xid, req->rq_reply_off);
432out:
433 if (unlikely(rc != 0))
434 ptlrpc_req_drop_rs(req);
435 ptlrpc_connection_put(conn);
436 return rc;
437}
438EXPORT_SYMBOL(ptlrpc_send_reply);
439
440int ptlrpc_reply (struct ptlrpc_request *req)
441{
442 if (req->rq_no_reply)
443 return 0;
444 else
445 return (ptlrpc_send_reply(req, 0));
446}
447EXPORT_SYMBOL(ptlrpc_reply);
448
449
450
451
452
453int ptlrpc_send_error(struct ptlrpc_request *req, int may_be_difficult)
454{
455 int rc;
456
457 if (req->rq_no_reply)
458 return 0;
459
460 if (!req->rq_repmsg) {
461 rc = lustre_pack_reply(req, 1, NULL, NULL);
462 if (rc)
463 return rc;
464 }
465
466 if (req->rq_status != -ENOSPC && req->rq_status != -EACCES &&
467 req->rq_status != -EPERM && req->rq_status != -ENOENT &&
468 req->rq_status != -EINPROGRESS && req->rq_status != -EDQUOT)
469 req->rq_type = PTL_RPC_MSG_ERR;
470
471 rc = ptlrpc_send_reply(req, may_be_difficult);
472 return rc;
473}
474EXPORT_SYMBOL(ptlrpc_send_error);
475
476int ptlrpc_error(struct ptlrpc_request *req)
477{
478 return ptlrpc_send_error(req, 0);
479}
480EXPORT_SYMBOL(ptlrpc_error);
481
482
483
484
485
486
487
488int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
489{
490 int rc;
491 int rc2;
492 int mpflag = 0;
493 struct ptlrpc_connection *connection;
494 lnet_handle_me_t reply_me_h;
495 lnet_md_t reply_md;
496 struct obd_device *obd = request->rq_import->imp_obd;
497
498 if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DROP_RPC))
499 return 0;
500
501 LASSERT(request->rq_type == PTL_RPC_MSG_REQUEST);
502 LASSERT(request->rq_wait_ctx == 0);
503
504
505
506 LASSERT(!request->rq_receiving_reply);
507
508 if (request->rq_import->imp_obd &&
509 request->rq_import->imp_obd->obd_fail) {
510 CDEBUG(D_HA, "muting rpc for failed imp obd %s\n",
511 request->rq_import->imp_obd->obd_name);
512
513 request->rq_err = 1;
514 request->rq_status = -ENODEV;
515 return -ENODEV;
516 }
517
518 connection = request->rq_import->imp_connection;
519
520 lustre_msg_set_handle(request->rq_reqmsg,
521 &request->rq_import->imp_remote_handle);
522 lustre_msg_set_type(request->rq_reqmsg, PTL_RPC_MSG_REQUEST);
523 lustre_msg_set_conn_cnt(request->rq_reqmsg,
524 request->rq_import->imp_conn_cnt);
525 lustre_msghdr_set_flags(request->rq_reqmsg,
526 request->rq_import->imp_msghdr_flags);
527
528 if (request->rq_resend)
529 lustre_msg_add_flags(request->rq_reqmsg, MSG_RESENT);
530
531 if (request->rq_memalloc)
532 mpflag = cfs_memory_pressure_get_and_set();
533
534 rc = sptlrpc_cli_wrap_request(request);
535 if (rc)
536 GOTO(out, rc);
537
538
539 if (request->rq_bulk != NULL) {
540 rc = ptlrpc_register_bulk (request);
541 if (rc != 0)
542 GOTO(out, rc);
543 }
544
545 if (!noreply) {
546 LASSERT (request->rq_replen != 0);
547 if (request->rq_repbuf == NULL) {
548 LASSERT(request->rq_repdata == NULL);
549 LASSERT(request->rq_repmsg == NULL);
550 rc = sptlrpc_cli_alloc_repbuf(request,
551 request->rq_replen);
552 if (rc) {
553
554
555 request->rq_err = 1;
556 request->rq_status = rc;
557 GOTO(cleanup_bulk, rc);
558 }
559 } else {
560 request->rq_repdata = NULL;
561 request->rq_repmsg = NULL;
562 }
563
564 rc = LNetMEAttach(request->rq_reply_portal,
565 connection->c_peer, request->rq_xid, 0,
566 LNET_UNLINK, LNET_INS_AFTER, &reply_me_h);
567 if (rc != 0) {
568 CERROR("LNetMEAttach failed: %d\n", rc);
569 LASSERT (rc == -ENOMEM);
570 GOTO(cleanup_bulk, rc = -ENOMEM);
571 }
572 }
573
574 spin_lock(&request->rq_lock);
575
576 request->rq_receiving_reply = !noreply;
577
578 request->rq_must_unlink = !noreply;
579
580 request->rq_replied = 0;
581 request->rq_err = 0;
582 request->rq_timedout = 0;
583 request->rq_net_err = 0;
584 request->rq_resend = 0;
585 request->rq_restart = 0;
586 request->rq_reply_truncate = 0;
587 spin_unlock(&request->rq_lock);
588
589 if (!noreply) {
590 reply_md.start = request->rq_repbuf;
591 reply_md.length = request->rq_repbuf_len;
592
593 reply_md.threshold = LNET_MD_THRESH_INF;
594
595 reply_md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT |
596 LNET_MD_MANAGE_REMOTE |
597 LNET_MD_TRUNCATE; ;
598 reply_md.user_ptr = &request->rq_reply_cbid;
599 reply_md.eq_handle = ptlrpc_eq_h;
600
601
602
603 rc = LNetMDAttach(reply_me_h, reply_md, LNET_RETAIN,
604 &request->rq_reply_md_h);
605 if (rc != 0) {
606 CERROR("LNetMDAttach failed: %d\n", rc);
607 LASSERT (rc == -ENOMEM);
608 spin_lock(&request->rq_lock);
609
610 request->rq_receiving_reply = 0;
611 spin_unlock(&request->rq_lock);
612 GOTO(cleanup_me, rc = -ENOMEM);
613 }
614
615 CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid "LPU64
616 ", portal %u\n",
617 request->rq_repbuf_len, request->rq_xid,
618 request->rq_reply_portal);
619 }
620
621
622 ptlrpc_request_addref(request);
623 if (obd->obd_svc_stats != NULL)
624 lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQACTIVE_CNTR,
625 atomic_read(&request->rq_import->imp_inflight));
626
627 OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
628
629 do_gettimeofday(&request->rq_arrival_time);
630 request->rq_sent = cfs_time_current_sec();
631
632
633 request->rq_deadline = request->rq_sent + request->rq_timeout +
634 ptlrpc_at_get_net_latency(request);
635
636 ptlrpc_pinger_sending_on_import(request->rq_import);
637
638 DEBUG_REQ(D_INFO, request, "send flg=%x",
639 lustre_msg_get_flags(request->rq_reqmsg));
640 rc = ptl_send_buf(&request->rq_req_md_h,
641 request->rq_reqbuf, request->rq_reqdata_len,
642 LNET_NOACK_REQ, &request->rq_req_cbid,
643 connection,
644 request->rq_request_portal,
645 request->rq_xid, 0);
646 if (rc == 0)
647 GOTO(out, rc);
648
649 ptlrpc_req_finished(request);
650 if (noreply)
651 GOTO(out, rc);
652
653 cleanup_me:
654
655
656
657 rc2 = LNetMEUnlink(reply_me_h);
658 LASSERT (rc2 == 0);
659
660 LASSERT(!request->rq_receiving_reply);
661
662 cleanup_bulk:
663
664
665 ptlrpc_unregister_bulk(request, 0);
666 out:
667 if (request->rq_memalloc)
668 cfs_memory_pressure_restore(mpflag);
669 return rc;
670}
671EXPORT_SYMBOL(ptl_send_rpc);
672
673
674
675
676int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd)
677{
678 struct ptlrpc_service *service = rqbd->rqbd_svcpt->scp_service;
679 static lnet_process_id_t match_id = {LNET_NID_ANY, LNET_PID_ANY};
680 int rc;
681 lnet_md_t md;
682 lnet_handle_me_t me_h;
683
684 CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
685 service->srv_req_portal);
686
687 if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_RQBD))
688 return (-ENOMEM);
689
690
691
692
693 rc = LNetMEAttach(service->srv_req_portal,
694 match_id, 0, ~0, LNET_UNLINK,
695 rqbd->rqbd_svcpt->scp_cpt >= 0 ?
696 LNET_INS_LOCAL : LNET_INS_AFTER, &me_h);
697 if (rc != 0) {
698 CERROR("LNetMEAttach failed: %d\n", rc);
699 return (-ENOMEM);
700 }
701
702 LASSERT(rqbd->rqbd_refcount == 0);
703 rqbd->rqbd_refcount = 1;
704
705 md.start = rqbd->rqbd_buffer;
706 md.length = service->srv_buf_size;
707 md.max_size = service->srv_max_req_size;
708 md.threshold = LNET_MD_THRESH_INF;
709 md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MAX_SIZE;
710 md.user_ptr = &rqbd->rqbd_cbid;
711 md.eq_handle = ptlrpc_eq_h;
712
713 rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h);
714 if (rc == 0)
715 return (0);
716
717 CERROR("LNetMDAttach failed: %d; \n", rc);
718 LASSERT (rc == -ENOMEM);
719 rc = LNetMEUnlink (me_h);
720 LASSERT (rc == 0);
721 rqbd->rqbd_refcount = 0;
722
723 return (-ENOMEM);
724}
725