Whamcloud - gitweb
b=16034,i=nic:
[fs/lustre-release.git] / lnet / klnds / ptllnd / ptllnd_cb.c
index d734ba8..8acf9d0 100644 (file)
@@ -1,19 +1,41 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- * Copyright (C) 2005 Cluster File Systems, Inc. All rights reserved.
- *   Author: PJ Kirner <pjkirner@clusterfs.com>
+ * GPL HEADER START
  *
- *   This file is part of the Lustre file system, http://www.lustre.org
- *   Lustre is a trademark of Cluster File Systems, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   This file is confidential source code owned by Cluster File Systems.
- *   No viewing, modification, compilation, redistribution, or any other
- *   form of use is permitted except through a signed license agreement.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   If you have not signed such an agreement, then you have no rights to
- *   this file.  Please destroy it immediately and contact CFS.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lnet/klnds/ptllnd/ptllnd_cb.c
+ *
+ * Author: PJ Kirner <pjkirner@clusterfs.com>
  */
 
 #include "ptllnd.h"
@@ -234,7 +256,7 @@ kptllnd_active_rdma(kptl_rx_t *rx, lnet_msg_t *lntmsg, int type,
                 kptllnd_tx_decref(tx);
                 return -EIO;
         }
-        
+
         spin_lock_irqsave(&peer->peer_lock, flags);
 
         tx->tx_lnet_msg = lntmsg;
@@ -279,6 +301,7 @@ kptllnd_active_rdma(kptl_rx_t *rx, lnet_msg_t *lntmsg, int type,
                 kptllnd_peer_close(peer, -EIO);
                 /* Everything (including this RDMA) queued on the peer will
                  * be completed with failure */
+                kptllnd_schedule_ptltrace_dump();
         }
 
         return 0;
@@ -598,7 +621,7 @@ kptllnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
         /*
          * We're done with the RX
          */
-        kptllnd_rx_done(rx);
+        kptllnd_rx_done(rx, PTLLND_POSTRX_PEER_CREDIT);
         return rc;
 }
 
@@ -665,8 +688,24 @@ kptllnd_watchdog(void *arg)
         /* threads shut down in phase 2 after all peers have been destroyed */
         while (kptllnd_data.kptl_shutdown < 2) {
 
+                /* add a check for needs ptltrace
+                 * yes, this is blatant hijacking of this thread
+                 * we can't dump directly from tx or rx _callbacks as it deadlocks portals
+                 * and takes out the node
+                */
+
+                if (atomic_read(&kptllnd_data.kptl_needs_ptltrace)) {
+#ifdef CRAY_XT3
+                        kptllnd_dump_ptltrace();
+                        /* we only dump once, no matter how many pending */
+                        atomic_set(&kptllnd_data.kptl_needs_ptltrace, 0);
+#else
+                        LBUG();
+#endif
+                }
+
                 timeout = (int)(deadline - jiffies);
-                
+
                 if (timeout <= 0) {
                         const int n = 4;
                         const int p = 1;
@@ -810,4 +849,3 @@ kptllnd_scheduler (void *arg)
         kptllnd_thread_fini();
         return 0;
 }
-