summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files3
-rw-r--r--sys/ddb/db_command.c17
-rw-r--r--sys/ddb/db_command.h3
-rw-r--r--sys/ddb/db_interface.h7
-rw-r--r--sys/nfs/nfs_debug.c61
5 files changed, 87 insertions, 4 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 5de76270547..a40798bae04 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.452 2008/12/21 21:37:43 miod Exp $
+# $OpenBSD: files,v 1.453 2009/01/18 13:36:56 thib Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -897,6 +897,7 @@ file netnatm/natm.c natm
file nfs/krpc_subr.c nfsclient
file nfs/nfs_bio.c nfsclient
file nfs/nfs_boot.c nfsclient
+file nfs/nfs_debug.c nfsclient & ddb
file nfs/nfs_node.c nfsclient
file nfs/nfs_kq.c nfsclient
file nfs/nfs_serv.c nfsserver
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 2c87db84340..4a8967b8328 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.49 2008/03/23 12:31:57 miod Exp $ */
+/* $OpenBSD: db_command.c,v 1.50 2009/01/18 13:36:56 thib Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -384,6 +384,19 @@ db_vnode_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
}
/*ARGSUSED*/
+void
+db_nfsreq_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
+{
+ boolean_t full = FALSE;
+
+ if (modif[0] == 'f')
+ full = TRUE;
+
+ db_nfsreq_print((struct nfsreq *) addr, full, db_printf);
+}
+
+
+/*ARGSUSED*/
void
db_show_panic_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
@@ -433,6 +446,7 @@ struct db_command db_show_all_cmds[] = {
{ "callout", db_show_callout, 0, NULL },
{ "pools", db_show_all_pools, 0, NULL },
{ "mounts", db_show_all_mounts, 0, NULL },
+ { "nfsreq", db_show_all_nfsreqs, 0, NULL },
{ NULL, NULL, 0, NULL }
};
@@ -452,6 +466,7 @@ struct db_command db_show_cmds[] = {
{ "registers", db_show_regs, 0, NULL },
{ "uvmexp", db_uvmexp_print_cmd, 0, NULL },
{ "vnode", db_vnode_print_cmd, 0, NULL },
+ { "nfsreq", db_nfsreq_print_cmd, 0, NULL },
{ "watches", db_listwatch_cmd, 0, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h
index 4662acf7b6c..9ed9da28f50 100644
--- a/sys/ddb/db_command.h
+++ b/sys/ddb/db_command.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.h,v 1.21 2008/03/23 12:31:58 miod Exp $ */
+/* $OpenBSD: db_command.h,v 1.22 2009/01/18 13:36:56 thib Exp $ */
/* $NetBSD: db_command.h,v 1.8 1996/02/05 01:56:55 christos Exp $ */
/*
@@ -50,6 +50,7 @@ void db_pool_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_proc_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_uvmexp_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_vnode_print_cmd(db_expr_t, int, db_expr_t, char *);
+void db_nfsreq_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_machine_commands_install(struct db_command *);
void db_help_cmd(db_expr_t, int, db_expr_t, char *);
void db_command_loop(void);
diff --git a/sys/ddb/db_interface.h b/sys/ddb/db_interface.h
index deea664f9f5..5e5a5f110e5 100644
--- a/sys/ddb/db_interface.h
+++ b/sys/ddb/db_interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.h,v 1.9 2006/07/12 05:55:22 deraadt Exp $ */
+/* $OpenBSD: db_interface.h,v 1.10 2009/01/18 13:36:56 thib Exp $ */
/* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */
/*
@@ -56,6 +56,11 @@ void vfs_mount_print(struct mount *, int, int (*)(const char *, ...));
/* kern/subr_pool.c */
void db_show_all_pools(db_expr_t, int, db_expr_t, char *);
+/* nfs/nfs_debug.c */
+struct nfsreq;
+void db_show_all_nfsreqs(db_expr_t, int, db_expr_t, char *);
+void db_nfsreq_print(struct nfsreq *, int, int (*)(const char *, ...));
+
/* ufs/ffs/ffs_softdep.c */
struct worklist;
void worklist_print(struct worklist *, int, int (*)(const char *, ...));
diff --git a/sys/nfs/nfs_debug.c b/sys/nfs/nfs_debug.c
new file mode 100644
index 00000000000..f9055724c86
--- /dev/null
+++ b/sys/nfs/nfs_debug.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2009 Thordur I. Bjornsson. <thib@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/mount.h>
+#include <sys/kernel.h>
+#include <sys/queue.h>
+
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
+#include <nfs/nfs.h>
+
+#include <machine/db_machdep.h>
+#include <ddb/db_interface.h>
+#include <ddb/db_output.h>
+
+extern struct nfsreqhead nfs_reqq;
+
+void
+db_show_all_nfsreqs(db_expr_t expr, int haddr, db_expr_t count, char *modif)
+{
+ struct nfsreq *rep;
+
+ if (TAILQ_EMPTY(&nfs_reqq)) {
+ db_printf("no outstanding requests\n");
+ return;
+ }
+
+ TAILQ_FOREACH(rep, &nfs_reqq, r_chain)
+ db_printf("%p\n", rep);
+
+}
+
+void
+db_nfsreq_print(struct nfsreq *rep, int full, int (*pr)(const char *, ...))
+{
+ (*pr)("xid 0x%x flags 0x%x rexmit %i procnum %i proc %p\n",
+ rep->r_xid, rep->r_flags, rep->r_rexmit, rep->r_procnum,
+ rep->r_procp);
+
+ if (full) {
+ (*pr)("mreq %p mrep %p md %p nfsmount %p vnode %p timer %i",
+ " rtt %i\n",
+ rep->r_mreq, rep->r_mrep, rep->r_md, rep->r_nmp,
+ rep->r_vp, rep->r_timer, rep->r_rtt);
+ }
+}