Whamcloud - gitweb
LU-12678 lnet: make "struct lnet_lnd" always "const".
[fs/lustre-release.git] / lnet / klnds / gnilnd / gnilnd.c
index 98f4b37..a197c99 100644 (file)
@@ -25,7 +25,7 @@
 #include "gnilnd.h"
 
 /* Primary entry points from LNET.  There are no guarantees against reentrance. */
-struct lnet_lnd the_kgnilnd = {
+const struct lnet_lnd the_kgnilnd = {
        .lnd_type       = GNILND,
        .lnd_startup    = kgnilnd_startup,
        .lnd_shutdown   = kgnilnd_shutdown,
@@ -272,7 +272,7 @@ kgnilnd_create_conn(kgn_conn_t **connp, kgn_device_t *dev)
        conn->gnc_next_tx = (int) GNILND_MAX_MSG_ID - 10;
 
        /* if this fails, we have conflicts and MAX_TX is too large */
-       CLASSERT(GNILND_MAX_MSG_ID < GNILND_MSGID_CLOSE);
+       BUILD_BUG_ON(GNILND_MAX_MSG_ID >= GNILND_MSGID_CLOSE);
 
        /* get a new unique CQ id for this conn */
        write_lock(&kgnilnd_data.kgn_peer_conn_lock);
@@ -505,7 +505,9 @@ kgnilnd_destroy_conn(kgn_conn_t *conn)
 void
 kgnilnd_peer_alive(kgn_peer_t *peer)
 {
-       set_mb(peer->gnp_last_alive, jiffies);
+       time64_t now = ktime_get_seconds();
+
+       set_mb(peer->gnp_last_alive, now);
 }
 
 void
@@ -601,11 +603,12 @@ kgnilnd_peer_notify(kgn_peer_t *peer, int error, int alive)
                        peer_nid = kgnilnd_lnd2lnetnid(net->gnn_ni->ni_nid,
                                                                 peer->gnp_nid);
 
-                       CDEBUG(D_NET, "peer 0x%p->%s last_alive %lu (%lus ago)\n",
+                       CDEBUG(D_NET, "peer 0x%p->%s last_alive %lld (%llds ago)\n",
                                peer, libcfs_nid2str(peer_nid), peer->gnp_last_alive,
-                               cfs_duration_sec(jiffies - peer->gnp_last_alive));
+                               ktime_get_seconds() - peer->gnp_last_alive);
 
                        lnet_notify(net->gnn_ni, peer_nid, alive,
+                                   (alive) ? true : false,
                                    peer->gnp_last_alive);
 
                        kgnilnd_net_decref(net);
@@ -2301,7 +2304,8 @@ int kgnilnd_base_startup(void)
 
        /* OK to call kgnilnd_api_shutdown() to cleanup now */
        kgnilnd_data.kgn_init = GNILND_INIT_DATA;
-       try_module_get(THIS_MODULE);
+       if (!try_module_get(THIS_MODULE))
+               GOTO(failed, rc = -ENOENT);
 
        rwlock_init(&kgnilnd_data.kgn_peer_conn_lock);
 
@@ -2891,7 +2895,7 @@ static int __init kgnilnd_init(void)
        if (rc != 0)
                return rc;
 
-       printk(KERN_INFO "Lustre: kgnilnd build version: "KGNILND_BUILD_REV"\n");
+       LCONSOLE_INFO("Lustre: kgnilnd build version: "LUSTRE_VERSION_STRING"\n");
 
        kgnilnd_insert_sysctl();
        kgnilnd_proc_init();
@@ -2903,7 +2907,7 @@ static int __init kgnilnd_init(void)
 
 MODULE_AUTHOR("Cray, Inc. <nic@cray.com>");
 MODULE_DESCRIPTION("Gemini LNet Network Driver");
-MODULE_VERSION(KGNILND_BUILD_REV);
+MODULE_VERSION(LUSTRE_VERSION_STRING);
 MODULE_LICENSE("GPL");
 
 module_init(kgnilnd_init);