svn commit: r225448 - in head/sys: conf kern sys
Attilio Rao
attilio at FreeBSD.org
Thu Sep 8 12:56:26 UTC 2011
Author: attilio
Date: Thu Sep 8 12:56:26 2011
New Revision: 225448
URL: http://svn.freebsd.org/changeset/base/225448
Log:
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
Modified:
head/sys/conf/NOTES
head/sys/conf/options
head/sys/kern/kern_shutdown.c
head/sys/kern/vfs_bio.c
head/sys/sys/buf.h
Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES Thu Sep 8 12:19:58 2011 (r225447)
+++ head/sys/conf/NOTES Thu Sep 8 12:56:26 2011 (r225448)
@@ -2929,7 +2929,6 @@ options SCSI_NCR_MYADDR=7
options SC_DEBUG_LEVEL=5 # Syscons debug level
options SC_RENDER_DEBUG # syscons rendering debugging
-options SHOW_BUSYBUFS # List buffers that prevent root unmount
options VFS_BIO_DEBUG # VFS buffer I/O debugging
options KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack
Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options Thu Sep 8 12:19:58 2011 (r225447)
+++ head/sys/conf/options Thu Sep 8 12:56:26 2011 (r225448)
@@ -156,7 +156,6 @@ QUOTA
SCHED_4BSD opt_sched.h
SCHED_STATS opt_sched.h
SCHED_ULE opt_sched.h
-SHOW_BUSYBUFS
SLEEPQUEUE_PROFILING
SLHCI_DEBUG opt_slhci.h
SPX_HACK
Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c Thu Sep 8 12:19:58 2011 (r225447)
+++ head/sys/kern/kern_shutdown.c Thu Sep 8 12:56:26 2011 (r225448)
@@ -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_
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) {
Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c Thu Sep 8 12:19:58 2011 (r225447)
+++ head/sys/kern/vfs_bio.c Thu Sep 8 12:56:26 2011 (r225448)
@@ -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)
Modified: head/sys/sys/buf.h
==============================================================================
--- head/sys/sys/buf.h Thu Sep 8 12:19:58 2011 (r225447)
+++ head/sys/sys/buf.h Thu Sep 8 12:56:26 2011 (r225448)
@@ -311,6 +311,12 @@ extern const char *buf_wmesg; /* Defaul
lockdestroy(&(bp)->b_lock)
/*
+ * Print informations on a buffer lock.
+ */
+#define BUF_LOCKPRINTINFO(bp) \
+ lockmgr_printinfo(&(bp)->b_lock)
+
+/*
* Buffer lock assertions.
*/
#if defined(INVARIANTS) && defined(INVARIANT_SUPPORT)
More information about the svn-src-head
mailing list