The Portals API uses a cookie 'handle' to identify an ME. This is
appropriate for a user-space API for objects maintained by the
kernel, but it brings no value when the API client and
implementation are both in the kernel, as is the case with Lustre
and LNet.
Instead of using a 'handle', a pointer to the 'struct lnet_me' can
be used. This object is not reference counted and is always freed
correctly, so there can be no case where the cookie becomes invalid
while it is still held - as can be seen by the fact that the return
value from LNetMEUnlink() is never used except to assert that it is
zero.
So use 'struct lnet_me *' directly instead of having indirection
through a 'struct lnet_handle_me'.
Also:
- change LNetMEUnlink() to return void as it cannot fail now.
- have LNetMEAttach() return the pointer, using ERR_PTR() to return
errors.
- discard ln_me_containers and don't store the me there-in.
- store an explicit 'cpt' in each me, we no longer store one
implicitly via the cookie.
Test-Parameters: trivial testlist=sanity-lnet
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I4e73e3217a244d8d15da90a8ba80371d1fd5f61f
Reviewed-on: https://review.whamcloud.com/36859
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
* request. MEs can be dynamically inserted into a match list by LNetMEAttach()
* and removed from its list by LNetMEUnlink().
* @{ */
* request. MEs can be dynamically inserted into a match list by LNetMEAttach()
* and removed from its list by LNetMEUnlink().
* @{ */
-int LNetMEAttach(unsigned int portal,
- struct lnet_process_id match_id_in,
- __u64 match_bits_in,
- __u64 ignore_bits_in,
- enum lnet_unlink unlink_in,
- enum lnet_ins_pos pos_in,
- struct lnet_handle_me *handle_out);
-
-int LNetMEUnlink(struct lnet_handle_me current_in);
+struct lnet_me *
+LNetMEAttach(unsigned int portal,
+ struct lnet_process_id match_id_in,
+ __u64 match_bits_in,
+ __u64 ignore_bits_in,
+ enum lnet_unlink unlink_in,
+ enum lnet_ins_pos pos_in);
+
+void LNetMEUnlink(struct lnet_me *current_in);
/** @} lnet_me */
/** \defgroup lnet_md Memory descriptors
/** @} lnet_me */
/** \defgroup lnet_md Memory descriptors
* and LNetMDBind(); one operation to unlink and release the resources
* associated with a MD: LNetMDUnlink().
* @{ */
* and LNetMDBind(); one operation to unlink and release the resources
* associated with a MD: LNetMDUnlink().
* @{ */
-int LNetMDAttach(struct lnet_handle_me current_in,
- struct lnet_md md_in,
- enum lnet_unlink unlink_in,
+int LNetMDAttach(struct lnet_me *current_in,
+ struct lnet_md md_in,
+ enum lnet_unlink unlink_in,
struct lnet_handle_md *md_handle_out);
int LNetMDBind(struct lnet_md md_in,
struct lnet_handle_md *md_handle_out);
int LNetMDBind(struct lnet_md md_in,
-lnet_me2handle(struct lnet_handle_me *handle, struct lnet_me *me)
-{
- handle->cookie = me->me_lh.lh_cookie;
-}
-
-static inline struct lnet_me *
-lnet_handle2me(struct lnet_handle_me *handle)
-{
- /* ALWAYS called with resource lock held */
- struct lnet_libhandle *lh;
- int cpt;
-
- cpt = lnet_cpt_of_cookie(handle->cookie);
- lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt],
- handle->cookie);
- if (lh == NULL)
- return NULL;
-
- return lh_entry(lh, struct lnet_me, me_lh);
-}
-
-static inline void
lnet_peer_net_addref_locked(struct lnet_peer_net *lpn)
{
atomic_inc(&lpn->lpn_refcount);
lnet_peer_net_addref_locked(struct lnet_peer_net *lpn)
{
atomic_inc(&lpn->lpn_refcount);
struct lnet_me {
struct list_head me_list;
struct lnet_me {
struct list_head me_list;
- struct lnet_libhandle me_lh;
struct lnet_process_id me_match_id;
unsigned int me_portal;
unsigned int me_pos; /* hash offset in mt_hash */
struct lnet_process_id me_match_id;
unsigned int me_portal;
unsigned int me_pos; /* hash offset in mt_hash */
int ln_nportals;
/* the vector of portals */
struct lnet_portal **ln_portals;
int ln_nportals;
/* the vector of portals */
struct lnet_portal **ln_portals;
- /* percpt ME containers */
- struct lnet_res_container **ln_me_containers;
/* percpt MD container */
struct lnet_res_container **ln_md_containers;
/* percpt MD container */
struct lnet_res_container **ln_md_containers;
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
-struct lnet_handle_me {
- __u64 cookie;
-};
-
/**
* Global process ID.
*/
/**
* Global process ID.
*/
if (rc != 0)
goto failed;
if (rc != 0)
goto failed;
- recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME);
- if (recs == NULL) {
- rc = -ENOMEM;
- goto failed;
- }
-
- the_lnet.ln_me_containers = recs;
-
recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD);
if (recs == NULL) {
rc = -ENOMEM;
recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD);
if (recs == NULL) {
rc = -ENOMEM;
the_lnet.ln_md_containers = NULL;
}
the_lnet.ln_md_containers = NULL;
}
- if (the_lnet.ln_me_containers != NULL) {
- lnet_res_containers_destroy(the_lnet.ln_me_containers);
- the_lnet.ln_me_containers = NULL;
- }
-
lnet_res_container_cleanup(&the_lnet.ln_eq_container);
lnet_msg_containers_destroy();
lnet_res_container_cleanup(&the_lnet.ln_eq_container);
lnet_msg_containers_destroy();
.nid = LNET_NID_ANY,
.pid = LNET_PID_ANY
};
.nid = LNET_NID_ANY,
.pid = LNET_PID_ANY
};
- struct lnet_handle_me me_handle;
struct lnet_md md = { NULL };
int rc, rc2;
struct lnet_md md = { NULL };
int rc, rc2;
}
/* Ping target ME/MD */
}
/* Ping target ME/MD */
- rc = LNetMEAttach(LNET_RESERVED_PORTAL, id,
+ me = LNetMEAttach(LNET_RESERVED_PORTAL, id,
LNET_PROTO_PING_MATCHBITS, 0,
LNET_PROTO_PING_MATCHBITS, 0,
- LNET_UNLINK, LNET_INS_AFTER,
- &me_handle);
- if (rc != 0) {
+ LNET_UNLINK, LNET_INS_AFTER);
+ if (IS_ERR(me)) {
+ rc = PTR_ERR(me);
CERROR("Can't create ping target ME: %d\n", rc);
goto fail_decref_ping_buffer;
}
CERROR("Can't create ping target ME: %d\n", rc);
goto fail_decref_ping_buffer;
}
md.eq_handle = the_lnet.ln_ping_target_eq;
md.user_ptr = *ppbuf;
md.eq_handle = the_lnet.ln_ping_target_eq;
md.user_ptr = *ppbuf;
- rc = LNetMDAttach(me_handle, md, LNET_RETAIN, ping_mdh);
+ rc = LNetMDAttach(me, md, LNET_RETAIN, ping_mdh);
if (rc != 0) {
CERROR("Can't attach ping target MD: %d\n", rc);
goto fail_unlink_ping_me;
if (rc != 0) {
CERROR("Can't attach ping target MD: %d\n", rc);
goto fail_unlink_ping_me;
return 0;
fail_unlink_ping_me:
return 0;
fail_unlink_ping_me:
- rc2 = LNetMEUnlink(me_handle);
- LASSERT(rc2 == 0);
fail_decref_ping_buffer:
LASSERT(lnet_ping_buffer_numref(*ppbuf) == 1);
lnet_ping_buffer_decref(*ppbuf);
fail_decref_ping_buffer:
LASSERT(lnet_ping_buffer_numref(*ppbuf) == 1);
lnet_ping_buffer_decref(*ppbuf);
{
struct lnet_process_id id = { LNET_NID_ANY, LNET_PID_ANY };
struct lnet_md md = { NULL };
{
struct lnet_process_id id = { LNET_NID_ANY, LNET_PID_ANY };
struct lnet_md md = { NULL };
- struct lnet_handle_me meh;
struct lnet_handle_md mdh;
struct lnet_handle_md old_mdh;
struct lnet_ping_buffer *pbuf;
struct lnet_handle_md mdh;
struct lnet_handle_md old_mdh;
struct lnet_ping_buffer *pbuf;
- rc = LNetMEAttach(LNET_RESERVED_PORTAL, id,
+ me = LNetMEAttach(LNET_RESERVED_PORTAL, id,
LNET_PROTO_PING_MATCHBITS, 0,
LNET_PROTO_PING_MATCHBITS, 0,
- LNET_UNLINK, LNET_INS_AFTER,
- &meh);
- if (rc) {
+ LNET_UNLINK, LNET_INS_AFTER);
+
+ if (IS_ERR(me)) {
+ rc = PTR_ERR(me);
CERROR("Can't create push target ME: %d\n", rc);
goto fail_decref_pbuf;
}
CERROR("Can't create push target ME: %d\n", rc);
goto fail_decref_pbuf;
}
md.user_ptr = pbuf;
md.eq_handle = the_lnet.ln_push_target_eq;
md.user_ptr = pbuf;
md.eq_handle = the_lnet.ln_push_target_eq;
- rc = LNetMDAttach(meh, md, LNET_RETAIN, &mdh);
+ rc = LNetMDAttach(me, md, LNET_RETAIN, &mdh);
if (rc) {
CERROR("Can't attach push MD: %d\n", rc);
if (rc) {
CERROR("Can't attach push MD: %d\n", rc);
}
lnet_ping_buffer_addref(pbuf);
}
lnet_ping_buffer_addref(pbuf);
-fail_unlink_meh:
- LNetMEUnlink(meh);
+fail_unlink_me:
+ LNetMEUnlink(me);
fail_decref_pbuf:
lnet_ping_buffer_decref(pbuf);
fail_return:
fail_decref_pbuf:
lnet_ping_buffer_decref(pbuf);
fail_return:
/**
* Create a memory descriptor and attach it to a ME
*
/**
* Create a memory descriptor and attach it to a ME
*
- * \param meh A handle for a ME to associate the new MD with.
+ * \param me An ME to associate the new MD with.
* \param umd Provides initial values for the user-visible parts of a MD.
* Other than its use for initialization, there is no linkage between this
* structure and the MD maintained by the LNet.
* \param umd Provides initial values for the user-visible parts of a MD.
* Other than its use for initialization, there is no linkage between this
* structure and the MD maintained by the LNet.
-LNetMDAttach(struct lnet_handle_me meh, struct lnet_md umd,
+LNetMDAttach(struct lnet_me *me, struct lnet_md umd,
enum lnet_unlink unlink, struct lnet_handle_md *handle)
{
LIST_HEAD(matches);
LIST_HEAD(drops);
enum lnet_unlink unlink, struct lnet_handle_md *handle)
{
LIST_HEAD(matches);
LIST_HEAD(drops);
struct lnet_libmd *md;
int cpt;
int rc;
struct lnet_libmd *md;
int cpt;
int rc;
if (rc != 0)
goto out_free;
if (rc != 0)
goto out_free;
- cpt = lnet_cpt_of_cookie(meh.cookie);
- me = lnet_handle2me(&meh);
- if (me == NULL)
- rc = -ENOENT;
- else if (me->me_md != NULL)
rc = -EBUSY;
else
rc = lnet_md_link(md, umd.eq_handle, cpt);
rc = -EBUSY;
else
rc = lnet_md_link(md, umd.eq_handle, cpt);
* \param pos Indicates whether the new ME should be prepended or
* appended to the match list. Allowed constants: LNET_INS_BEFORE,
* LNET_INS_AFTER.
* \param pos Indicates whether the new ME should be prepended or
* appended to the match list. Allowed constants: LNET_INS_BEFORE,
* LNET_INS_AFTER.
- * \param handle On successful returns, a handle to the newly created ME
- * object is saved here. This handle can be used later in LNetMEUnlink(),
- * or LNetMDAttach() functions.
- * \retval 0 On success.
- * \retval -EINVAL If \a portal is invalid.
- * \retval -ENOMEM If new ME object cannot be allocated.
+ * \retval A handle to the newly created ME is returned on success
+ * \retval ERR_PTR(-EINVAL) If \a portal is invalid.
+ * \retval ERR_PTR(-ENOMEM) If new ME object cannot be allocated.
LNetMEAttach(unsigned int portal,
struct lnet_process_id match_id,
__u64 match_bits, __u64 ignore_bits,
LNetMEAttach(unsigned int portal,
struct lnet_process_id match_id,
__u64 match_bits, __u64 ignore_bits,
- enum lnet_unlink unlink, enum lnet_ins_pos pos,
- struct lnet_handle_me *handle)
+ enum lnet_unlink unlink, enum lnet_ins_pos pos)
{
struct lnet_match_table *mtable;
struct lnet_me *me;
{
struct lnet_match_table *mtable;
struct lnet_me *me;
LASSERT(the_lnet.ln_refcount > 0);
if ((int)portal >= the_lnet.ln_nportals)
LASSERT(the_lnet.ln_refcount > 0);
if ((int)portal >= the_lnet.ln_nportals)
+ return ERR_PTR(-EINVAL);
mtable = lnet_mt_of_attach(portal, match_id,
match_bits, ignore_bits, pos);
if (mtable == NULL) /* can't match portal type */
mtable = lnet_mt_of_attach(portal, match_id,
match_bits, ignore_bits, pos);
if (mtable == NULL) /* can't match portal type */
+ return ERR_PTR(-EPERM);
me = lnet_me_alloc();
if (me == NULL)
me = lnet_me_alloc();
if (me == NULL)
+ return ERR_PTR(-ENOMEM);
lnet_res_lock(mtable->mt_cpt);
lnet_res_lock(mtable->mt_cpt);
me->me_unlink = unlink;
me->me_md = NULL;
me->me_unlink = unlink;
me->me_md = NULL;
- lnet_res_lh_initialize(the_lnet.ln_me_containers[mtable->mt_cpt],
- &me->me_lh);
+ me->me_cpt = mtable->mt_cpt;
+
if (ignore_bits != 0)
head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE];
else
if (ignore_bits != 0)
head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE];
else
else
list_add(&me->me_list, head);
else
list_add(&me->me_list, head);
- lnet_me2handle(handle, me);
-
lnet_res_unlock(mtable->mt_cpt);
lnet_res_unlock(mtable->mt_cpt);
}
EXPORT_SYMBOL(LNetMEAttach);
}
EXPORT_SYMBOL(LNetMEAttach);
* \retval -ENOENT If \a meh does not point to a valid ME.
* \see LNetMDUnlink() for the discussion on delivering unlink event.
*/
* \retval -ENOENT If \a meh does not point to a valid ME.
* \see LNetMDUnlink() for the discussion on delivering unlink event.
*/
-int
-LNetMEUnlink(struct lnet_handle_me meh)
+void
+LNetMEUnlink(struct lnet_me *me)
struct lnet_libmd *md;
struct lnet_event ev;
int cpt;
LASSERT(the_lnet.ln_refcount > 0);
struct lnet_libmd *md;
struct lnet_event ev;
int cpt;
LASSERT(the_lnet.ln_refcount > 0);
- cpt = lnet_cpt_of_cookie(meh.cookie);
- me = lnet_handle2me(&meh);
- if (me == NULL) {
- lnet_res_unlock(cpt);
- return -ENOENT;
- }
-
md = me->me_md;
if (md != NULL) {
md->md_flags |= LNET_MD_FLAG_ABORTED;
md = me->me_md;
if (md != NULL) {
md->md_flags |= LNET_MD_FLAG_ABORTED;
lnet_me_unlink(me);
lnet_res_unlock(cpt);
lnet_me_unlink(me);
lnet_res_unlock(cpt);
}
EXPORT_SYMBOL(LNetMEUnlink);
}
EXPORT_SYMBOL(LNetMEUnlink);
- lnet_res_lh_invalidate(&me->me_lh);
{
int rc;
struct lnet_md md;
{
int rc;
struct lnet_md md;
- struct lnet_handle_me meh;
- rc = LNetMEAttach(portal, peer, matchbits, 0, LNET_UNLINK,
- local ? LNET_INS_LOCAL : LNET_INS_AFTER, &meh);
- if (rc != 0) {
+ me = LNetMEAttach(portal, peer, matchbits, 0, LNET_UNLINK,
+ local ? LNET_INS_LOCAL : LNET_INS_AFTER);
+ if (IS_ERR(me)) {
+ rc = PTR_ERR(me);
CERROR("LNetMEAttach failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
return -ENOMEM;
CERROR("LNetMEAttach failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
return -ENOMEM;
md.options = options;
md.eq_handle = srpc_data.rpc_lnet_eq;
md.options = options;
md.eq_handle = srpc_data.rpc_lnet_eq;
- rc = LNetMDAttach(meh, md, LNET_UNLINK, mdh);
+ rc = LNetMDAttach(me, md, LNET_UNLINK, mdh);
if (rc != 0) {
CERROR("LNetMDAttach failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
if (rc != 0) {
CERROR("LNetMDAttach failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
- rc = LNetMEUnlink(meh);
- LASSERT(rc == 0);
struct ptlrpc_bulk_desc *desc = req->rq_bulk;
struct lnet_process_id peer;
int rc = 0;
struct ptlrpc_bulk_desc *desc = req->rq_bulk;
struct lnet_process_id peer;
int rc = 0;
int posted_md;
int total_md;
__u64 mbits;
int posted_md;
int total_md;
__u64 mbits;
- struct lnet_handle_me me_h;
struct lnet_md md;
ENTRY;
struct lnet_md md;
ENTRY;
OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_ATTACH)) {
rc = -ENOMEM;
} else {
OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_ATTACH)) {
rc = -ENOMEM;
} else {
- rc = LNetMEAttach(desc->bd_portal, peer, mbits, 0,
- LNET_UNLINK, LNET_INS_AFTER, &me_h);
+ me = LNetMEAttach(desc->bd_portal, peer, mbits, 0,
+ LNET_UNLINK, LNET_INS_AFTER);
+ rc = PTR_ERR_OR_ZERO(me);
}
if (rc != 0) {
CERROR("%s: LNetMEAttach failed x%llu/%d: rc = %d\n",
}
if (rc != 0) {
CERROR("%s: LNetMEAttach failed x%llu/%d: rc = %d\n",
}
/* About to let the network at it... */
}
/* About to let the network at it... */
- rc = LNetMDAttach(me_h, md, LNET_UNLINK,
+ rc = LNetMDAttach(me, md, LNET_UNLINK,
&desc->bd_mds[posted_md]);
if (rc != 0) {
CERROR("%s: LNetMDAttach failed x%llu/%d: rc = %d\n",
desc->bd_import->imp_obd->obd_name, mbits,
posted_md, rc);
&desc->bd_mds[posted_md]);
if (rc != 0) {
CERROR("%s: LNetMDAttach failed x%llu/%d: rc = %d\n",
desc->bd_import->imp_obd->obd_name, mbits,
posted_md, rc);
- rc2 = LNetMEUnlink(me_h);
- LASSERT(rc2 == 0);
int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
{
int rc;
int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
{
int rc;
int mpflag = 0;
struct lnet_handle_md bulk_cookie;
struct ptlrpc_connection *connection;
int mpflag = 0;
struct lnet_handle_md bulk_cookie;
struct ptlrpc_connection *connection;
- struct lnet_handle_me reply_me_h;
+ struct lnet_me *reply_me = NULL;
struct lnet_md reply_md;
struct obd_import *imp = request->rq_import;
struct obd_device *obd = imp->imp_obd;
struct lnet_md reply_md;
struct obd_import *imp = request->rq_import;
struct obd_device *obd = imp->imp_obd;
request->rq_repmsg = NULL;
}
request->rq_repmsg = NULL;
}
- rc = LNetMEAttach(request->rq_reply_portal,/*XXX FIXME bug 249*/
- connection->c_peer, request->rq_xid, 0,
- LNET_UNLINK, LNET_INS_AFTER, &reply_me_h);
- if (rc != 0) {
- CERROR("LNetMEAttach failed: %d\n", rc);
- LASSERT (rc == -ENOMEM);
- GOTO(cleanup_bulk, rc = -ENOMEM);
- }
- }
+ reply_me = LNetMEAttach(request->rq_reply_portal,
+ connection->c_peer, request->rq_xid, 0,
+ LNET_UNLINK, LNET_INS_AFTER);
+ if (IS_ERR(reply_me)) {
+ rc = PTR_ERR(reply_me);
+ CERROR("LNetMEAttach failed: %d\n", rc);
+ LASSERT(rc == -ENOMEM);
+ GOTO(cleanup_bulk, rc = -ENOMEM);
+ }
+ }
spin_lock(&request->rq_lock);
/* We are responsible for unlinking the reply buffer */
spin_lock(&request->rq_lock);
/* We are responsible for unlinking the reply buffer */
/* We must see the unlink callback to set rq_reply_unlinked,
* so we can't auto-unlink */
/* We must see the unlink callback to set rq_reply_unlinked,
* so we can't auto-unlink */
- rc = LNetMDAttach(reply_me_h, reply_md, LNET_RETAIN,
- &request->rq_reply_md_h);
- if (rc != 0) {
- CERROR("LNetMDAttach failed: %d\n", rc);
- LASSERT (rc == -ENOMEM);
+ rc = LNetMDAttach(reply_me, reply_md, LNET_RETAIN,
+ &request->rq_reply_md_h);
+ if (rc != 0) {
+ CERROR("LNetMDAttach failed: %d\n", rc);
+ LASSERT(rc == -ENOMEM);
spin_lock(&request->rq_lock);
/* ...but the MD attach didn't succeed... */
request->rq_receiving_reply = 0;
spin_lock(&request->rq_lock);
/* ...but the MD attach didn't succeed... */
request->rq_receiving_reply = 0;
cleanup_me:
/* MEUnlink is safe; the PUT didn't even get off the ground, and
* nobody apart from the PUT's target has the right nid+XID to
cleanup_me:
/* MEUnlink is safe; the PUT didn't even get off the ground, and
* nobody apart from the PUT's target has the right nid+XID to
- * access the reply buffer. */
- rc2 = LNetMEUnlink(reply_me_h);
- LASSERT (rc2 == 0);
+ * access the reply buffer.
+ */
+ LNetMEUnlink(reply_me);
/* UNLINKED callback called synchronously */
LASSERT(!request->rq_receiving_reply);
/* UNLINKED callback called synchronously */
LASSERT(!request->rq_receiving_reply);
};
int rc;
struct lnet_md md;
};
int rc;
struct lnet_md md;
- struct lnet_handle_me me_h;
CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
service->srv_req_portal);
CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
service->srv_req_portal);
/* NB: CPT affinity service should use new LNet flag LNET_INS_LOCAL,
* which means buffer can only be attached on local CPT, and LND
* threads can find it by grabbing a local lock */
/* NB: CPT affinity service should use new LNet flag LNET_INS_LOCAL,
* which means buffer can only be attached on local CPT, and LND
* threads can find it by grabbing a local lock */
- rc = LNetMEAttach(service->srv_req_portal,
+ me = LNetMEAttach(service->srv_req_portal,
match_id, 0, ~0, LNET_UNLINK,
rqbd->rqbd_svcpt->scp_cpt >= 0 ?
match_id, 0, ~0, LNET_UNLINK,
rqbd->rqbd_svcpt->scp_cpt >= 0 ?
- LNET_INS_LOCAL : LNET_INS_AFTER, &me_h);
- if (rc != 0) {
- CERROR("LNetMEAttach failed: %d\n", rc);
- return (-ENOMEM);
- }
+ LNET_INS_LOCAL : LNET_INS_AFTER);
+ if (IS_ERR(me)) {
+ CERROR("LNetMEAttach failed: %ld\n", PTR_ERR(me));
+ return -ENOMEM;
+ }
LASSERT(rqbd->rqbd_refcount == 0);
rqbd->rqbd_refcount = 1;
LASSERT(rqbd->rqbd_refcount == 0);
rqbd->rqbd_refcount = 1;
md.user_ptr = &rqbd->rqbd_cbid;
md.eq_handle = ptlrpc_eq_h;
md.user_ptr = &rqbd->rqbd_cbid;
md.eq_handle = ptlrpc_eq_h;
- rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h);
- if (rc == 0)
- return (0);
+ rc = LNetMDAttach(me, md, LNET_UNLINK, &rqbd->rqbd_md_h);
+ if (rc == 0)
+ return 0;
- CERROR("LNetMDAttach failed: %d; \n", rc);
- LASSERT (rc == -ENOMEM);
- rc = LNetMEUnlink (me_h);
- LASSERT (rc == 0);
- rqbd->rqbd_refcount = 0;
+ CERROR("LNetMDAttach failed: %d;\n", rc);
+ LASSERT(rc == -ENOMEM);
+ LNetMEUnlink(me);
+ LASSERT(rc == 0);
+ rqbd->rqbd_refcount = 0;