staging/lustre: don't assert ln_refcount in LNetGetId
authorPeng Tao <bergwolf@gmail.com>
Mon, 15 Jul 2013 14:27:07 +0000 (22:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jul 2013 19:23:57 +0000 (12:23 -0700)
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 <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/api-ni.c

index e88bee3624973277cc531f140e3665a99bc308ff..250c618687041890685fee63a2fdde8ed3399a6d 100644 (file)
@@ -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();