Whamcloud - gitweb
LU-2745 lnet: fix failure handle of create reply 59/7659/2
authorLiang Zhen <liang.zhen@intel.com>
Wed, 27 Feb 2013 07:54:52 +0000 (15:54 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 30 Oct 2013 21:55:38 +0000 (21:55 +0000)
error handler of lnet_create_reply_msg() didn't release lnet_res_lock
if lnet_msg_alloc() failed.
It can be fixed by moving validation check of msg out from lock.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Change-Id: I5a25b7e07d24f5c4f165a3266cca6e79dffc1461
Reviewed-on: http://review.whamcloud.com/7659
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Tested-by: Hudson
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/lib-move.c

index 5240aac..b2ce1f7 100644 (file)
@@ -2207,16 +2207,16 @@ lnet_create_reply_msg (lnet_ni_t *ni, lnet_msg_t *getmsg)
        LASSERT(!getmsg->msg_target_is_router);
        LASSERT(!getmsg->msg_routing);
 
+       if (msg == NULL) {
+               CERROR("%s: Dropping REPLY from %s: can't allocate msg\n",
+                      libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id));
+               goto drop;
+       }
+
        cpt = lnet_cpt_of_cookie(getmd->md_lh.lh_cookie);
        lnet_res_lock(cpt);
 
-        LASSERT (getmd->md_refcount > 0);
-
-        if (msg == NULL) {
-                CERROR ("%s: Dropping REPLY from %s: can't allocate msg\n",
-                        libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id));
-                goto drop;
-        }
+       LASSERT(getmd->md_refcount > 0);
 
         if (getmd->md_threshold == 0) {
                 CERROR ("%s: Dropping REPLY from %s for inactive MD %p\n",