Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / ptlrpc / niobuf.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
5  *
6  *   This file is part of the Lustre file system, http://www.lustre.org
7  *   Lustre is a trademark of Cluster File Systems, Inc.
8  *
9  *   You may have signed or agreed to another license before downloading
10  *   this software.  If so, you are bound by the terms and conditions
11  *   of that agreement, and the following does not apply to you.  See the
12  *   LICENSE file included with this distribution for more information.
13  *
14  *   If you did not agree to a different license, then this copy of Lustre
15  *   is open source software; you can redistribute it and/or modify it
16  *   under the terms of version 2 of the GNU General Public License as
17  *   published by the Free Software Foundation.
18  *
19  *   In either case, Lustre is distributed in the hope that it will be
20  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
21  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *   license text for more details.
23  *
24  */
25
26 #define DEBUG_SUBSYSTEM S_RPC
27 #ifndef __KERNEL__
28 #include <liblustre.h>
29 #endif
30 #include <obd_support.h>
31 #include <lustre_net.h>
32 #include <lustre_lib.h>
33 #include <obd.h>
34 #include "ptlrpc_internal.h"
35
36 static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len,
37                          lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid,
38                          struct ptlrpc_connection *conn, int portal, __u64 xid)
39 {
40         int              rc;
41         lnet_md_t         md;
42         ENTRY;
43
44         LASSERT (portal != 0);
45         LASSERT (conn != NULL);
46         CDEBUG (D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer));
47         md.start     = base;
48         md.length    = len;
49         md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1;
50         md.options   = PTLRPC_MD_OPTIONS;
51         md.user_ptr  = cbid;
52         md.eq_handle = ptlrpc_eq_h;
53
54         if (ack == LNET_ACK_REQ &&
55             OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_ACK | OBD_FAIL_ONCE)) {
56                 /* don't ask for the ack to simulate failing client */
57                 ack = LNET_NOACK_REQ;
58                 obd_fail_loc |= OBD_FAIL_ONCE | OBD_FAILED;
59         }
60
61         rc = LNetMDBind (md, LNET_UNLINK, mdh);
62         if (rc != 0) {
63                 CERROR ("LNetMDBind failed: %d\n", rc);
64                 LASSERT (rc == -ENOMEM);
65                 RETURN (-ENOMEM);
66         }
67
68         CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64"\n",
69                len, portal, xid);
70
71         rc = LNetPut (conn->c_self, *mdh, ack, 
72                       conn->c_peer, portal, xid, 0, 0);
73         if (rc != 0) {
74                 int rc2;
75                 /* We're going to get an UNLINK event when I unlink below,
76                  * which will complete just like any other failed send, so
77                  * I fall through and return success here! */
78                 CERROR("LNetPut(%s, %d, "LPD64") failed: %d\n",
79                        libcfs_id2str(conn->c_peer), portal, xid, rc);
80                 rc2 = LNetMDUnlink(*mdh);
81                 LASSERTF(rc2 == 0, "rc2 = %d\n", rc2);
82         }
83
84         RETURN (0);
85 }
86
87 int ptlrpc_start_bulk_transfer (struct ptlrpc_bulk_desc *desc)
88 {
89         struct ptlrpc_connection *conn = desc->bd_export->exp_connection;
90         int                       rc;
91         int                       rc2;
92         lnet_md_t                 md;
93         __u64                     xid;
94         ENTRY;
95
96         if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_BULK_PUT_NET)) 
97                 RETURN(0);
98
99         /* NB no locking required until desc is on the network */
100         LASSERT (!desc->bd_network_rw);
101         LASSERT (desc->bd_type == BULK_PUT_SOURCE ||
102                  desc->bd_type == BULK_GET_SINK);
103         desc->bd_success = 0;
104         desc->bd_sender = LNET_NID_ANY;
105
106         md.user_ptr = &desc->bd_cbid;
107         md.eq_handle = ptlrpc_eq_h;
108         md.threshold = 2; /* SENT and ACK/REPLY */
109         md.options = PTLRPC_MD_OPTIONS;
110         ptlrpc_fill_bulk_md(&md, desc);
111
112         LASSERT (desc->bd_cbid.cbid_fn == server_bulk_callback);
113         LASSERT (desc->bd_cbid.cbid_arg == desc);
114
115         /* NB total length may be 0 for a read past EOF, so we send a 0
116          * length bulk, since the client expects a bulk event. */
117
118         rc = LNetMDBind(md, LNET_UNLINK, &desc->bd_md_h);
119         if (rc != 0) {
120                 CERROR("LNetMDBind failed: %d\n", rc);
121                 LASSERT (rc == -ENOMEM);
122                 RETURN(-ENOMEM);
123         }
124
125         /* Client's bulk and reply matchbits are the same */
126         xid = desc->bd_req->rq_xid;
127         CDEBUG(D_NET, "Transferring %u pages %u bytes via portal %d "
128                "id %s xid "LPX64"\n", desc->bd_iov_count,
129                desc->bd_nob, desc->bd_portal, 
130                libcfs_id2str(conn->c_peer), xid);
131
132         /* Network is about to get at the memory */
133         desc->bd_network_rw = 1;
134
135         if (desc->bd_type == BULK_PUT_SOURCE)
136                 rc = LNetPut (conn->c_self, desc->bd_md_h, LNET_ACK_REQ, 
137                               conn->c_peer, desc->bd_portal, xid, 0, 0);
138         else
139                 rc = LNetGet (conn->c_self, desc->bd_md_h, 
140                               conn->c_peer, desc->bd_portal, xid, 0);
141
142         if (rc != 0) {
143                 /* Can't send, so we unlink the MD bound above.  The UNLINK
144                  * event this creates will signal completion with failure,
145                  * so we return SUCCESS here! */
146                 CERROR("Transfer(%s, %d, "LPX64") failed: %d\n",
147                        libcfs_id2str(conn->c_peer), desc->bd_portal, xid, rc);
148                 rc2 = LNetMDUnlink(desc->bd_md_h);
149                 LASSERT (rc2 == 0);
150         }
151
152         RETURN(0);
153 }
154
155 void ptlrpc_abort_bulk (struct ptlrpc_bulk_desc *desc)
156 {
157         /* Server side bulk abort. Idempotent. Not thread-safe (i.e. only
158          * serialises with completion callback) */
159         struct l_wait_info lwi;
160         int                rc;
161
162         LASSERT (!in_interrupt ());             /* might sleep */
163
164         if (!ptlrpc_bulk_active(desc))          /* completed or */
165                 return;                         /* never started */
166         
167         /* Do not send any meaningful data over the wire for evicted clients */
168         if (desc->bd_export && desc->bd_export->exp_failed)
169                 ptl_rpc_wipe_bulk_pages(desc);
170
171         /* The unlink ensures the callback happens ASAP and is the last
172          * one.  If it fails, it must be because completion just happened,
173          * but we must still l_wait_event() in this case, to give liblustre
174          * a chance to run server_bulk_callback()*/
175
176         LNetMDUnlink (desc->bd_md_h);
177
178         for (;;) {
179                 /* Network access will complete in finite time but the HUGE
180                  * timeout lets us CWARN for visibility of sluggish NALs */
181                 lwi = LWI_TIMEOUT (cfs_time_seconds(300), NULL, NULL);
182                 rc = l_wait_event(desc->bd_waitq, 
183                                   !ptlrpc_bulk_active(desc), &lwi);
184                 if (rc == 0)
185                         return;
186
187                 LASSERT(rc == -ETIMEDOUT);
188                 CWARN("Unexpectedly long timeout: desc %p\n", desc);
189         }
190 }
191
192 int ptlrpc_register_bulk (struct ptlrpc_request *req)
193 {
194         struct ptlrpc_bulk_desc *desc = req->rq_bulk;
195         lnet_process_id_t peer;
196         int rc;
197         int rc2;
198         lnet_handle_me_t  me_h;
199         lnet_md_t         md;
200         ENTRY;
201
202         if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_BULK_GET_NET)) 
203                 RETURN(0);
204
205         /* NB no locking required until desc is on the network */
206         LASSERT (desc->bd_nob > 0);
207         LASSERT (!desc->bd_network_rw);
208         LASSERT (desc->bd_iov_count <= PTLRPC_MAX_BRW_PAGES);
209         LASSERT (desc->bd_req != NULL);
210         LASSERT (desc->bd_type == BULK_PUT_SINK ||
211                  desc->bd_type == BULK_GET_SOURCE);
212
213         desc->bd_success = 0;
214         desc->bd_sender = LNET_NID_ANY;
215
216         peer = desc->bd_import->imp_connection->c_peer;
217
218         md.user_ptr = &desc->bd_cbid;
219         md.eq_handle = ptlrpc_eq_h;
220         md.threshold = 1;                       /* PUT or GET */
221         md.options = PTLRPC_MD_OPTIONS | 
222                      ((desc->bd_type == BULK_GET_SOURCE) ? 
223                       LNET_MD_OP_GET : LNET_MD_OP_PUT);
224         ptlrpc_fill_bulk_md(&md, desc);
225
226         LASSERT (desc->bd_cbid.cbid_fn == client_bulk_callback);
227         LASSERT (desc->bd_cbid.cbid_arg == desc);
228
229         /* XXX Registering the same xid on retried bulk makes my head
230          * explode trying to understand how the original request's bulk
231          * might interfere with the retried request -eeb */
232         LASSERTF (!desc->bd_registered || req->rq_xid != desc->bd_last_xid,
233                   "registered: %d  rq_xid: "LPU64" bd_last_xid: "LPU64"\n",
234                   desc->bd_registered, req->rq_xid, desc->bd_last_xid);
235         desc->bd_registered = 1;
236         desc->bd_last_xid = req->rq_xid;
237
238         rc = LNetMEAttach(desc->bd_portal, peer,
239                          req->rq_xid, 0, LNET_UNLINK, LNET_INS_AFTER, &me_h);
240         if (rc != 0) {
241                 CERROR("LNetMEAttach failed: %d\n", rc);
242                 LASSERT (rc == -ENOMEM);
243                 RETURN (-ENOMEM);
244         }
245
246         /* About to let the network at it... */
247         desc->bd_network_rw = 1;
248         rc = LNetMDAttach(me_h, md, LNET_UNLINK, &desc->bd_md_h);
249         if (rc != 0) {
250                 CERROR("LNetMDAttach failed: %d\n", rc);
251                 LASSERT (rc == -ENOMEM);
252                 desc->bd_network_rw = 0;
253                 rc2 = LNetMEUnlink (me_h);
254                 LASSERT (rc2 == 0);
255                 RETURN (-ENOMEM);
256         }
257
258         CDEBUG(D_NET, "Setup bulk %s buffers: %u pages %u bytes, xid "LPX64", "
259                "portal %u\n",
260                desc->bd_type == BULK_GET_SOURCE ? "get-source" : "put-sink",
261                desc->bd_iov_count, desc->bd_nob,
262                req->rq_xid, desc->bd_portal);
263         RETURN(0);
264 }
265
266 void ptlrpc_unregister_bulk (struct ptlrpc_request *req)
267 {
268         /* Disconnect a bulk desc from the network. Idempotent. Not
269          * thread-safe (i.e. only interlocks with completion callback). */
270         struct ptlrpc_bulk_desc *desc = req->rq_bulk;
271         cfs_waitq_t             *wq;
272         struct l_wait_info       lwi;
273         int                      rc;
274
275         LASSERT (!in_interrupt ());     /* might sleep */
276
277         if (!ptlrpc_bulk_active(desc))  /* completed or */
278                 return;                 /* never registered */
279
280         LASSERT (desc->bd_req == req);  /* bd_req NULL until registered */
281
282         /* the unlink ensures the callback happens ASAP and is the last
283          * one.  If it fails, it must be because completion just happened,
284          * but we must still l_wait_event() in this case to give liblustre
285          * a chance to run client_bulk_callback() */
286
287         LNetMDUnlink (desc->bd_md_h);
288         
289         if (req->rq_set != NULL)
290                 wq = &req->rq_set->set_waitq;
291         else
292                 wq = &req->rq_reply_waitq;
293
294         for (;;) {
295                 /* Network access will complete in finite time but the HUGE
296                  * timeout lets us CWARN for visibility of sluggish NALs */
297                 lwi = LWI_TIMEOUT (cfs_time_seconds(300), NULL, NULL);
298                 rc = l_wait_event(*wq, !ptlrpc_bulk_active(desc), &lwi);
299                 if (rc == 0)
300                         return;
301
302                 LASSERT (rc == -ETIMEDOUT);
303                 DEBUG_REQ(D_WARNING,req,"Unexpectedly long timeout: desc %p\n",
304                           desc);
305         }
306 }
307
308 int ptlrpc_send_reply (struct ptlrpc_request *req, int may_be_difficult)
309 {
310         struct ptlrpc_service     *svc = req->rq_rqbd->rqbd_service;
311         struct ptlrpc_reply_state *rs = req->rq_reply_state;
312         struct ptlrpc_connection  *conn;
313         int                        rc;
314
315         /* We must already have a reply buffer (only ptlrpc_error() may be
316          * called without one).  We must also have a request buffer which
317          * is either the actual (swabbed) incoming request, or a saved copy
318          * if this is a req saved in target_queue_final_reply(). */
319         LASSERT (req->rq_reqmsg != NULL);
320         LASSERT (req->rq_repmsg != NULL);
321         LASSERT (rs != NULL);
322         LASSERT (req->rq_repmsg == rs->rs_msg);
323         LASSERT (may_be_difficult || !rs->rs_difficult);
324         LASSERT (rs->rs_cb_id.cbid_fn == reply_out_callback);
325         LASSERT (rs->rs_cb_id.cbid_arg == rs);
326
327         if (req->rq_export && req->rq_export->exp_obd &&
328             req->rq_export->exp_obd->obd_fail) {
329                 /* Failed obd's only send ENODEV */
330                 req->rq_type = PTL_RPC_MSG_ERR;
331                 req->rq_status = -ENODEV;
332                 CDEBUG(D_HA, "sending ENODEV from failed obd %d\n",
333                        req->rq_export->exp_obd->obd_minor);
334         }
335
336         if (req->rq_type != PTL_RPC_MSG_ERR)
337                 req->rq_type = PTL_RPC_MSG_REPLY;
338
339         lustre_msg_set_type(req->rq_repmsg, req->rq_type);
340         lustre_msg_set_status(req->rq_repmsg, req->rq_status);
341         lustre_msg_set_opc(req->rq_repmsg, lustre_msg_get_opc(req->rq_reqmsg));
342
343         if (req->rq_export == NULL || req->rq_export->exp_connection == NULL)
344                 conn = ptlrpc_get_connection(req->rq_peer, req->rq_self, NULL);
345         else
346                 conn = ptlrpc_connection_addref(req->rq_export->exp_connection);
347
348         if (conn == NULL) {
349                 CERROR("not replying on NULL connection\n"); /* bug 9635 */
350                 return -ENOTCONN;
351         }
352         atomic_inc (&svc->srv_outstanding_replies);
353         ptlrpc_rs_addref(rs);                   /* +1 ref for the network */
354
355         rc = ptl_send_buf (&rs->rs_md_h, req->rq_repmsg, req->rq_replen,
356                            rs->rs_difficult ? LNET_ACK_REQ : LNET_NOACK_REQ,
357                            &rs->rs_cb_id, conn,
358                            svc->srv_rep_portal, req->rq_xid);
359         if (rc != 0) {
360                 atomic_dec (&svc->srv_outstanding_replies);
361                 ptlrpc_rs_decref(rs);
362         }
363         ptlrpc_put_connection(conn);
364         return rc;
365 }
366
367 int ptlrpc_reply (struct ptlrpc_request *req)
368 {
369         return (ptlrpc_send_reply (req, 0));
370 }
371
372 int ptlrpc_error(struct ptlrpc_request *req)
373 {
374         int rc;
375         ENTRY;
376
377         if (!req->rq_repmsg) {
378                 rc = lustre_pack_reply(req, 1, NULL, NULL);
379                 if (rc)
380                         RETURN(rc);
381         }
382
383         req->rq_type = PTL_RPC_MSG_ERR;
384
385         rc = ptlrpc_send_reply(req, 0);
386         RETURN(rc);
387 }
388
389 int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
390 {
391         int rc;
392         int rc2;
393         struct ptlrpc_connection *connection;
394         lnet_handle_me_t  reply_me_h;
395         lnet_md_t         reply_md;
396         ENTRY;
397
398         OBD_FAIL_RETURN(OBD_FAIL_PTLRPC_DROP_RPC, 0); 
399
400         LASSERT (request->rq_type == PTL_RPC_MSG_REQUEST);
401
402         /* If this is a re-transmit, we're required to have disengaged
403          * cleanly from the previous attempt */
404         LASSERT (!request->rq_receiving_reply);
405
406         if (request->rq_import->imp_obd &&
407             request->rq_import->imp_obd->obd_fail) {
408                 CDEBUG(D_HA, "muting rpc for failed imp obd %s\n",
409                        request->rq_import->imp_obd->obd_name);
410                 /* this prevents us from waiting in ptlrpc_queue_wait */
411                 request->rq_err = 1;
412                 RETURN(-ENODEV);
413         }
414         
415         connection = request->rq_import->imp_connection;
416
417         if (request->rq_bulk != NULL) {
418                 rc = ptlrpc_register_bulk (request);
419                 if (rc != 0)
420                         RETURN(rc);
421         }
422
423         lustre_msg_set_handle(request->rq_reqmsg,
424                               &request->rq_import->imp_remote_handle);
425         lustre_msg_set_type(request->rq_reqmsg, PTL_RPC_MSG_REQUEST);
426         lustre_msg_set_conn_cnt(request->rq_reqmsg,
427                                 request->rq_import->imp_conn_cnt);
428
429         if (!noreply) {
430                 LASSERT (request->rq_replen != 0);
431                 if (request->rq_repmsg == NULL)
432                         OBD_ALLOC(request->rq_repmsg, request->rq_replen);
433                 if (request->rq_repmsg == NULL)
434                         GOTO(cleanup_bulk, rc = -ENOMEM);
435
436                 rc = LNetMEAttach(request->rq_reply_portal,/*XXX FIXME bug 249*/
437                                   connection->c_peer, request->rq_xid, 0,
438                                   LNET_UNLINK, LNET_INS_AFTER, &reply_me_h);
439                 if (rc != 0) {
440                         CERROR("LNetMEAttach failed: %d\n", rc);
441                         LASSERT (rc == -ENOMEM);
442                         GOTO(cleanup_repmsg, rc = -ENOMEM);
443                 }
444         }
445
446         spin_lock(&request->rq_lock);
447         /* If the MD attach succeeds, there _will_ be a reply_in callback */
448         request->rq_receiving_reply = !noreply;
449         /* Clear any flags that may be present from previous sends. */
450         request->rq_replied = 0;
451         request->rq_err = 0;
452         request->rq_timedout = 0;
453         request->rq_net_err = 0;
454         request->rq_resend = 0;
455         request->rq_restart = 0;
456         spin_unlock(&request->rq_lock);
457
458         if (!noreply) {
459                 reply_md.start     = request->rq_repmsg;
460                 reply_md.length    = request->rq_replen;
461                 reply_md.threshold = 1;
462                 reply_md.options   = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT;
463                 reply_md.user_ptr  = &request->rq_reply_cbid;
464                 reply_md.eq_handle = ptlrpc_eq_h;
465
466                 rc = LNetMDAttach(reply_me_h, reply_md, LNET_UNLINK, 
467                                  &request->rq_reply_md_h);
468                 if (rc != 0) {
469                         CERROR("LNetMDAttach failed: %d\n", rc);
470                         LASSERT (rc == -ENOMEM);
471                         spin_lock(&request->rq_lock);
472                         /* ...but the MD attach didn't succeed... */
473                         request->rq_receiving_reply = 0;
474                         spin_unlock(&request->rq_lock);
475                         GOTO(cleanup_me, rc -ENOMEM);
476                 }
477
478                 CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid "LPU64
479                        ", portal %u\n",
480                        request->rq_replen, request->rq_xid,
481                        request->rq_reply_portal);
482         }
483
484         /* add references on request and import for request_out_callback */
485         ptlrpc_request_addref(request);
486         atomic_inc(&request->rq_import->imp_inflight);
487
488         OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
489
490         request->rq_sent = CURRENT_SECONDS;
491         ptlrpc_pinger_sending_on_import(request->rq_import);
492         rc = ptl_send_buf(&request->rq_req_md_h,
493                           request->rq_reqmsg, request->rq_reqlen,
494                           LNET_NOACK_REQ, &request->rq_req_cbid,
495                           connection,
496                           request->rq_request_portal,
497                           request->rq_xid);
498         if (rc == 0) {
499                 ptlrpc_lprocfs_rpc_sent(request);
500                 RETURN(rc);
501         }
502
503          /* drop request_out_callback refs, we couldn't start the send */
504         atomic_dec(&request->rq_import->imp_inflight);
505         ptlrpc_req_finished(request);
506
507         if (noreply)
508                 RETURN(rc);
509         else
510                 GOTO(cleanup_me, rc);
511  cleanup_me:
512         /* MEUnlink is safe; the PUT didn't even get off the ground, and
513          * nobody apart from the PUT's target has the right nid+XID to
514          * access the reply buffer. */
515         rc2 = LNetMEUnlink(reply_me_h);
516         LASSERT (rc2 == 0);
517         /* UNLINKED callback called synchronously */
518         LASSERT (!request->rq_receiving_reply);
519
520  cleanup_repmsg:
521         OBD_FREE(request->rq_repmsg, request->rq_replen);
522         request->rq_repmsg = NULL;
523
524  cleanup_bulk:
525         if (request->rq_bulk != NULL)
526                 ptlrpc_unregister_bulk(request);
527
528         return rc;
529 }
530
531 int ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd)
532 {
533         struct ptlrpc_service   *service = rqbd->rqbd_service;
534         static lnet_process_id_t  match_id = {LNET_NID_ANY, LNET_PID_ANY};
535         int                      rc;
536         lnet_md_t                 md;
537         lnet_handle_me_t          me_h;
538
539         CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
540                service->srv_req_portal);
541
542         if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_RQBD))
543                 return (-ENOMEM);
544
545         rc = LNetMEAttach(service->srv_req_portal,
546                           match_id, 0, ~0, LNET_UNLINK, LNET_INS_AFTER, &me_h);
547         if (rc != 0) {
548                 CERROR("LNetMEAttach failed: %d\n", rc);
549                 return (-ENOMEM);
550         }
551
552         LASSERT(rqbd->rqbd_refcount == 0);
553         rqbd->rqbd_refcount = 1;
554
555         md.start     = rqbd->rqbd_buffer;
556         md.length    = service->srv_buf_size;
557         md.max_size  = service->srv_max_req_size;
558         md.threshold = LNET_MD_THRESH_INF;
559         md.options   = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MAX_SIZE;
560         md.user_ptr  = &rqbd->rqbd_cbid;
561         md.eq_handle = ptlrpc_eq_h;
562         
563         rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h);
564         if (rc == 0)
565                 return (0);
566
567         CERROR("LNetMDAttach failed: %d; \n", rc);
568         LASSERT (rc == -ENOMEM);
569         rc = LNetMEUnlink (me_h);
570         LASSERT (rc == 0);
571         rqbd->rqbd_refcount = 0;
572         
573         return (-ENOMEM);
574 }