+ /* We need to verify there are no conns left before we let the threads
+ * shut down otherwise we could clean up the peers but still have
+ * some outstanding conns due to orphaned datagram conns that are
+ * being cleaned up.
+ */
+ i = 2;
+ while (atomic_read(&kgnilnd_data.kgn_nconns) != 0) {
+ i++;
+
+ for(j = 0; j < kgnilnd_data.kgn_ndevs; ++j) {
+ kgn_device_t *dev = &kgnilnd_data.kgn_devices[j];
+ kgnilnd_schedule_device(dev);
+ }
+
+ CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET,
+ "Waiting for conns to be cleaned up %d\n",atomic_read(&kgnilnd_data.kgn_nconns));
+ cfs_pause(cfs_time_seconds(1));
+ }