summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-09-08 12:56:26 +0000
committerattilio <attilio@FreeBSD.org>2011-09-08 12:56:26 +0000
commit5494aebd9759f24281f8a0cfa2065a17ba997533 (patch)
treefc833be579c529eada2aa0565d3869ad2cebefd6 /sys/kern
parent41cd87c13ef2eae05c70bdf24dd18c20d8722a21 (diff)
downloadFreeBSD-src-5494aebd9759f24281f8a0cfa2065a17ba997533.zip
FreeBSD-src-5494aebd9759f24281f8a0cfa2065a17ba997533.tar.gz
Improve the informations reported in case of busy buffers during the shutdown:
- Axe out the SHOW_BUSYBUFS option and uses a tunable for selectively enable/disable it, which is defaulted for not printing anything (0 value) but can be changed for printing (1 value) and be verbose (2 value) - Improves the informations outputed: right now, there is no track of the actual struct buf object or vnode which are referenced by the shutdown process, but it is printed the related struct bufobj object which is not really helpful - Add more verbosity about the state of the struct buf lock and the vnode informations, with the latter to be activated separately by the sysctl Sponsored by: Sandvine Incorporated Reviewed by: emaste, kib Approved by: re (ksmith) MFC after: 10 days
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_shutdown.c28
-rw-r--r--sys/kern/vfs_bio.c2
2 files changed, 21 insertions, 9 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 7621b15..6a8a597 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
#include "opt_kdb.h"
#include "opt_panic.h"
-#include "opt_show_busybufs.h"
#include "opt_sched.h"
#include "opt_watchdog.h"
@@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$");
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
+#include <sys/vnode.h>
#ifdef SW_WATCHDOG
#include <sys/watchdog.h>
#endif
@@ -123,6 +123,14 @@ TUNABLE_INT("kern.sync_on_panic", &sync_on_panic);
SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment");
+#ifndef DIAGNOSTIC
+static int show_busybufs;
+#else
+static int show_busybufs = 1;
+#endif
+SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW,
+ &show_busybufs, 0, "");
+
/*
* Variable panicstr contains argument to first call to panic; used as flag
* to indicate that the kernel has already called panic.
@@ -389,13 +397,17 @@ kern_reboot(int howto)
}
#endif
nbusy++;
-#if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC)
- printf(
- "%d: bufobj:%p, flags:%0x, blkno:%ld, lblkno:%ld\n",
- nbusy, bp->b_bufobj,
- bp->b_flags, (long)bp->b_blkno,
- (long)bp->b_lblkno);
-#endif
+ if (show_busybufs > 0) {
+ printf(
+ "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:",
+ nbusy, bp, bp->b_vp, bp->b_flags,
+ (intmax_t)bp->b_blkno,
+ (intmax_t)bp->b_lblkno);
+ BUF_LOCKPRINTINFO(bp);
+ if (show_busybufs > 1)
+ vn_printf(bp->b_vp,
+ "vnode content: ");
+ }
}
}
if (nbusy) {
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a6ad81e..7b5b015 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -4020,7 +4020,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer)
db_printf("\n");
}
db_printf(" ");
- lockmgr_printinfo(&bp->b_lock);
+ BUF_LOCKPRINTINFO(bp);
}
DB_SHOW_COMMAND(lockedbufs, lockedbufs)
OpenPOWER on IntegriCloud