*
* 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.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
#define DEBUG_SUBSYSTEM S_CLASS
+#include <linux/pid_namespace.h>
#include <linux/kthread.h>
#include <obd_class.h>
#include <lprocfs_status.h>
static void obd_zombie_export_add(struct obd_export *exp);
static void obd_zombie_import_add(struct obd_import *imp);
static void print_export_data(struct obd_export *exp,
- const char *status, int locks);
+ const char *status, int locks, int debug_level);
struct list_head obd_stale_exports;
spinlock_t obd_stale_export_lock;
struct obd_import *class_new_import(struct obd_device *obd)
{
struct obd_import *imp;
+ struct pid_namespace *curr_pid_ns = ll_task_pid_ns(current);
OBD_ALLOC(imp, sizeof(*imp));
if (imp == NULL)
mutex_init(&imp->imp_sec_mutex);
init_waitqueue_head(&imp->imp_recovery_waitq);
+ if (curr_pid_ns->child_reaper)
+ imp->imp_sec_refpid = curr_pid_ns->child_reaper->pid;
+ else
+ imp->imp_sec_refpid = 1;
+
atomic_set(&imp->imp_refcount, 2);
atomic_set(&imp->imp_unregistering, 0);
atomic_set(&imp->imp_inflight, 0);
obd->obd_name, exp->exp_client_uuid.uuid,
exp->exp_connection == NULL ? "<unknown>" :
libcfs_nid2str(exp->exp_connection->c_peer.nid));
- print_export_data(exp, "EVICTING", 0);
+ print_export_data(exp, "EVICTING", 0, D_HA);
}
spin_unlock(&obd->obd_dev_lock);
#endif
static void print_export_data(struct obd_export *exp, const char *status,
- int locks)
+ int locks, int debug_level)
{
struct ptlrpc_reply_state *rs;
struct ptlrpc_reply_state *first_reply = NULL;
}
spin_unlock(&exp->exp_lock);
- CDEBUG(D_HA, "%s: %s %p %s %s %d (%d %d %d) %d %d %d %d: %p %s %llu\n",
- exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid,
+ CDEBUG(debug_level, "%s: %s %p %s %s %d (%d %d %d) %d %d %d %d: "
+ "%p %s %llu stale:%d\n",
+ exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid,
obd_export_nid2str(exp), atomic_read(&exp->exp_refcount),
atomic_read(&exp->exp_rpc_count),
atomic_read(&exp->exp_cb_count),
atomic_read(&exp->exp_locks_count),
- exp->exp_disconnected, exp->exp_delayed, exp->exp_failed,
- nreplies, first_reply, nreplies > 3 ? "..." : "",
- exp->exp_last_committed);
+ exp->exp_disconnected, exp->exp_delayed, exp->exp_failed,
+ nreplies, first_reply, nreplies > 3 ? "..." : "",
+ exp->exp_last_committed, !list_empty(&exp->exp_stale_list));
#if LUSTRE_TRACKS_LOCK_EXP_REFS
- if (locks && class_export_dump_hook != NULL)
- class_export_dump_hook(exp);
+ if (locks && class_export_dump_hook != NULL)
+ class_export_dump_hook(exp);
#endif
}
-void dump_exports(struct obd_device *obd, int locks)
+void dump_exports(struct obd_device *obd, int locks, int debug_level)
{
struct obd_export *exp;
spin_lock(&obd->obd_dev_lock);
list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain)
- print_export_data(exp, "ACTIVE", locks);
+ print_export_data(exp, "ACTIVE", locks, debug_level);
list_for_each_entry(exp, &obd->obd_unlinked_exports, exp_obd_chain)
- print_export_data(exp, "UNLINKED", locks);
+ print_export_data(exp, "UNLINKED", locks, debug_level);
list_for_each_entry(exp, &obd->obd_delayed_exports, exp_obd_chain)
- print_export_data(exp, "DELAYED", locks);
+ print_export_data(exp, "DELAYED", locks, debug_level);
spin_unlock(&obd->obd_dev_lock);
spin_lock(&obd_zombie_impexp_lock);
list_for_each_entry(exp, &obd_zombie_exports, exp_obd_chain)
- print_export_data(exp, "ZOMBIE", locks);
+ print_export_data(exp, "ZOMBIE", locks, debug_level);
spin_unlock(&obd_zombie_impexp_lock);
}
"The obd refcount = %d. Is it stuck?\n",
obd->obd_name, waited,
atomic_read(&obd->obd_refcount));
- dump_exports(obd, 1);
+ dump_exports(obd, 1, D_CONSOLE | D_WARNING);
}
waited *= 2;
spin_lock(&obd->obd_dev_lock);