diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2009-01-18 13:36:57 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2009-01-18 13:36:57 +0000 |
commit | 6499c045342f2e124d2c9e97ca8ed6aa2738d088 (patch) | |
tree | 2902ae79b7d381acf052574bbc753a5b4cd85760 | |
parent | b448e19a391267ccd83f922326382437f7259e22 (diff) |
Add nfs ddb hooks, for now only to show all the outstanding nfsreq's
and to print out struct nfsreq.
"get it in so people can pound on it" blambert@
OK and information_s_ on the manpage from miod@
-rw-r--r-- | share/man/man4/ddb.4 | 22 | ||||
-rw-r--r-- | sys/conf/files | 3 | ||||
-rw-r--r-- | sys/ddb/db_command.c | 17 | ||||
-rw-r--r-- | sys/ddb/db_command.h | 3 | ||||
-rw-r--r-- | sys/ddb/db_interface.h | 7 | ||||
-rw-r--r-- | sys/nfs/nfs_debug.c | 61 |
6 files changed, 107 insertions, 6 deletions
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index b9b0528644e..f5d95a31ffa 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ddb.4,v 1.56 2008/12/23 10:05:24 jmc Exp $ +.\" $OpenBSD: ddb.4,v 1.57 2009/01/18 13:36:56 thib Exp $ .\" $NetBSD: ddb.4,v 1.5 1994/11/30 16:22:09 jtc Exp $ .\" .\" Mach Operating System @@ -25,7 +25,7 @@ .\" any improvements or extensions that they make and grant Carnegie Mellon .\" the rights to redistribute these changes. .\" -.Dd $Mdocdate: December 23 2008 $ +.Dd $Mdocdate: January 18 2009 $ .Dt DDB 4 .Os .Sh NAME @@ -752,6 +752,20 @@ modifier is specified prints out all currently attached to this .Li vnode . .\" -------------------- +.It Xo +.Ic show nfsreq +.Op Cm /f +.Ar addr +.Xc +Prints the +.Li struct nfsreq +at +.Ar addr. +If the +.Cm /f +modifier is specified prints out additional +information as well. +.\" -------------------- .It Ic show watches Displays all watchpoints set with the .Ic watch @@ -806,6 +820,10 @@ These addresses can be used in the .Ic show vnode command. .El +.\" -------------------- +.It Ic show all nfsreq +Display a list of pointers to all outstanding nfs requests. +.Pp .El .It Ic callout A synonym for the 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); + } +} |