Whamcloud - gitweb
LU-12824 o2ib: Record rc in debug log on startup failure
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd.c
index 11a39f5..432c450 100644 (file)
@@ -3192,10 +3192,10 @@ static int kiblnd_dev_start_threads(struct kib_dev *dev, u32 *cpts, int ncpts)
 static int
 kiblnd_startup(struct lnet_ni *ni)
 {
-       char *ifname;
+       char *ifname = NULL;
        struct lnet_inetdev *ifaces = NULL;
        struct kib_dev *ibdev = NULL;
-       struct kib_net *net;
+       struct kib_net *net = NULL;
        unsigned long flags;
        int rc;
        int i;
@@ -3210,8 +3210,10 @@ kiblnd_startup(struct lnet_ni *ni)
 
        LIBCFS_ALLOC(net, sizeof(*net));
        ni->ni_data = net;
-       if (net == NULL)
+       if (net == NULL) {
+               rc = -ENOMEM;
                goto failed;
+       }
 
        net->ibn_incarnation = ktime_get_real_ns() / NSEC_PER_USEC;
 
@@ -3226,6 +3228,7 @@ kiblnd_startup(struct lnet_ni *ni)
                /* Use the IPoIB interface specified in 'networks=' */
                if (ni->ni_interfaces[1] != NULL) {
                        CERROR("ko2iblnd: Multiple interfaces not supported\n");
+                       rc = -EINVAL;
                        goto failed;
                }
 
@@ -3236,6 +3239,7 @@ kiblnd_startup(struct lnet_ni *ni)
 
        if (strlen(ifname) >= sizeof(ibdev->ibd_ifname)) {
                CERROR("IPoIB interface name too long: %s\n", ifname);
+               rc = -E2BIG;
                goto failed;
        }
 
@@ -3309,7 +3313,9 @@ failed:
        kfree(ifaces);
        kiblnd_shutdown(ni);
 
-       CDEBUG(D_NET, "kiblnd_startup failed\n");
+       CDEBUG(D_NET, "Configuration of device %s failed: rc = %d\n",
+              ifname ? ifname : "", rc);
+
        return -ENETDOWN;
 }