X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Flnet%2Flib-md.c;h=53a855751833a0c6589e582c039f32feeed23c5d;hb=97084f70a6c2956d49d8dc289aeb8ede84e5f7b4;hp=9bf890c9477b64a8751110a1b9af99478665f0ee;hpb=ccabce23bd9e366c345c852f565766a799f61238;p=fs%2Flustre-release.git diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index 9bf890c..53a8557 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -269,7 +269,7 @@ lnet_md_build(struct lnet_libmd *lmd, struct lnet_md *umd, int unlink) /* must be called with resource lock held */ static int -lnet_md_link(struct lnet_libmd *md, struct lnet_handle_eq eq_handle, int cpt) +lnet_md_link(struct lnet_libmd *md, struct lnet_eq *eq, int cpt) { struct lnet_res_container *container = the_lnet.ln_md_containers[cpt]; @@ -285,12 +285,8 @@ lnet_md_link(struct lnet_libmd *md, struct lnet_handle_eq eq_handle, int cpt) * maybe there we shouldn't even allow LNET_EQ_NONE!) * LASSERT (eq == NULL); */ - if (!LNetEQHandleIsInvalid(eq_handle)) { - md->md_eq = lnet_handle2eq(&eq_handle); - - if (md->md_eq == NULL) - return -ENOENT; - + if (eq) { + md->md_eq = eq; (*md->md_eq->eq_refs[cpt])++; } @@ -318,7 +314,6 @@ lnet_md_deconstruct(struct lnet_libmd *lmd, struct lnet_md *umd) umd->max_size = lmd->md_max_size; umd->options = lmd->md_options; umd->user_ptr = lmd->md_user_ptr; - lnet_eq2handle(&umd->eq_handle, lmd->md_eq); } static int @@ -343,7 +338,7 @@ lnet_md_validate(struct lnet_md *umd) /** * 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. @@ -366,12 +361,11 @@ lnet_md_validate(struct lnet_md *umd) * a MD. */ int -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) { - struct list_head matches = LIST_HEAD_INIT(matches); - struct list_head drops = LIST_HEAD_INIT(drops); - struct lnet_me *me; + LIST_HEAD(matches); + LIST_HEAD(drops); struct lnet_libmd *md; int cpt; int rc; @@ -394,14 +388,11 @@ LNetMDAttach(struct lnet_handle_me meh, struct lnet_md umd, if (rc != 0) goto out_free; - cpt = lnet_cpt_of_cookie(meh.cookie); + cpt = me->me_cpt; lnet_res_lock(cpt); - me = lnet_handle2me(&meh); - if (me == NULL) - rc = -ENOENT; - else if (me->me_md != NULL) + if (me->me_md) rc = -EBUSY; else rc = lnet_md_link(md, umd.eq_handle, cpt); @@ -472,6 +463,13 @@ LNetMDBind(struct lnet_md umd, enum lnet_unlink unlink, if (rc != 0) goto out_free; + if (md->md_length > LNET_MTU) { + CERROR("Invalid length: too big transfer size %u, %d max\n", + md->md_length, LNET_MTU); + rc = -EINVAL; + goto out_free; + } + cpt = lnet_res_lock_current(); rc = lnet_md_link(md, umd.eq_handle, cpt); @@ -549,6 +547,9 @@ LNetMDUnlink(struct lnet_handle_md mdh) lnet_eq_enqueue_event(md->md_eq, &ev); } + if (md->md_rspt_ptr != NULL) + lnet_detach_rsp_tracker(md, cpt); + lnet_md_unlink(md); lnet_res_unlock(cpt);