Whamcloud - gitweb
LU-9913 lnet: balance references in lnet_discover_peer_locked() 95/28695/2
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 24 Aug 2017 20:01:34 +0000 (15:01 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 25 Aug 2017 18:22:35 +0000 (18:22 +0000)
In lnet_discover_peer_locked() avoid a leaked reference to the peer in
the non-blocking discovery case.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ic48414859c923af1ebb197b0b0f2f8d6752043ac
Reviewed-on: https://review.whamcloud.com/28695
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
Reviewed-by: Quentin Bouget <quentin.bouget@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/peer.c

index 507fcbe..232a06d 100644 (file)
@@ -2012,7 +2012,6 @@ again:
                if (lnet_peer_is_uptodate(lp))
                        break;
                lnet_peer_queue_for_discovery(lp);
                if (lnet_peer_is_uptodate(lp))
                        break;
                lnet_peer_queue_for_discovery(lp);
-               lnet_peer_addref_locked(lp);
                /*
                 * if caller requested a non-blocking operation then
                 * return immediately. Once discovery is complete then the
                /*
                 * if caller requested a non-blocking operation then
                 * return immediately. Once discovery is complete then the
@@ -2021,6 +2020,8 @@ again:
                 */
                if (!block)
                        break;
                 */
                if (!block)
                        break;
+
+               lnet_peer_addref_locked(lp);
                lnet_net_unlock(LNET_LOCK_EX);
                schedule();
                finish_wait(&lp->lp_dc_waitq, &wait);
                lnet_net_unlock(LNET_LOCK_EX);
                schedule();
                finish_wait(&lp->lp_dc_waitq, &wait);