Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756776Ab3GONLB (ORCPT ); Mon, 15 Jul 2013 09:11:01 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:55477 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756154Ab3GONK6 (ORCPT ); Mon, 15 Jul 2013 09:10:58 -0400 From: Peng Tao To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Peng Tao , Peng Tao , Andreas Dilger Subject: [PATCH-v2 04/17] staging/lustre: don't assert ln_refcount in LNetGetId Date: Mon, 15 Jul 2013 21:08:02 +0800 Message-Id: <1373893695-4094-5-git-send-email-bergwolf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373893695-4094-1-git-send-email-bergwolf@gmail.com> References: <1373893695-4094-1-git-send-email-bergwolf@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1188 Lines: 36 If LNetNIInit() fails, we'll get zero ln_refcount. So fail LNetGetId() properly instead of asserting. We can get to it when socklnd fails to scan network interfaces, which is possible if Lustre is builtin. Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger --- drivers/staging/lustre/lnet/lnet/api-ni.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index e88bee3..250c618 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1541,7 +1541,10 @@ LNetGetId(unsigned int index, lnet_process_id_t *id) int rc = -ENOENT; LASSERT(the_lnet.ln_init); - LASSERT(the_lnet.ln_refcount > 0); + + /* LNetNI initilization failed? */ + if (the_lnet.ln_refcount == 0) + return rc; cpt = lnet_net_lock_current(); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/