Whamcloud - gitweb
LU-4423 lnet: check for null pointer at line 1569 of router.c
[fs/lustre-release.git] / lnet / lnet / router.c
index b53545b..6699245 100644 (file)
@@ -3,8 +3,7 @@
  *
  * Copyright (c) 2011, 2014, Intel Corporation.
  *
- *   This file is part of Portals
- *   http://sourceforge.net/projects/sandiaportals/
+ *   This file is part of Lustre, https://wiki.hpdd.intel.com/
  *
  *   Portals is free software; you can redistribute it and/or
  *   modify it under the terms of version 2 of the GNU General Public
@@ -137,7 +136,7 @@ lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp)
          * NB individual events can be missed; the only guarantee is that you
          * always get the most recent news */
 
-       if (lp->lp_notifying)
+       if (lp->lp_notifying || ni == NULL)
                 return;
 
         lp->lp_notifying = 1;
@@ -817,8 +816,9 @@ lnet_wait_known_routerstate(void)
                if (all_known)
                         return;
 
-                cfs_pause(cfs_time_seconds(1));
-        }
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(cfs_time_seconds(1));
+       }
 }
 
 void
@@ -1194,7 +1194,8 @@ lnet_prune_rc_data(int wait_unlink)
                i++;
                CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET,
                       "Waiting for rc buffers to unlink\n");
-               cfs_pause(cfs_time_seconds(1) / 4);
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(cfs_time_seconds(1) / 4);
 
                lnet_net_lock(LNET_LOCK_EX);
        }
@@ -1275,7 +1276,7 @@ rescan:
 
                lnet_prune_rc_data(0); /* don't wait for UNLINK */
 
-               /* Call cfs_pause() here always adds 1 to load average
+               /* Call schedule_timeout() here always adds 1 to load average
                 * because kernel counts # active tasks as nr_running
                 * + nr_uninterruptible. */
                /* if there are any routes then wakeup every second.  If