[lustre-devel] [PATCH 24/24] lustre: lnet: balance references in lnet_discover_peer_locked()

NeilBrown neilb at suse.com
Sun Oct 7 16:19:38 PDT 2018


From: John L. Hammond <john.hammond at intel.com>

In lnet_discover_peer_locked() avoid a leaked reference to the peer in
the non-blocking discovery case.

WC-bug-id: https://jira.whamcloud.com/browse/LU-9913
Signed-off-by: John L. Hammond <john.hammond at intel.com>
Reviewed-on: https://review.whamcloud.com/28695
Reviewed-by: Olaf Weber <olaf.weber at hpe.com>
Reviewed-by: Quentin Bouget <quentin.bouget at cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin at intel.com>
Signed-off-by: NeilBrown <neilb at suse.com>
---
 drivers/staging/lustre/lnet/lnet/peer.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c
index 5f61fca09f44..db36b5cf31e1 100644
--- a/drivers/staging/lustre/lnet/lnet/peer.c
+++ b/drivers/staging/lustre/lnet/lnet/peer.c
@@ -2010,7 +2010,6 @@ lnet_discover_peer_locked(struct lnet_peer_ni *lpni, int cpt, bool block)
 		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
@@ -2019,6 +2018,8 @@ lnet_discover_peer_locked(struct lnet_peer_ni *lpni, int cpt, bool block)
 		 */
 		if (!block)
 			break;
+
+		lnet_peer_addref_locked(lp);
 		lnet_net_unlock(LNET_LOCK_EX);
 		schedule();
 		finish_wait(&lp->lp_dc_waitq, &wait);




More information about the lustre-devel mailing list