summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-05-12 14:37:47 +0000
committerrwatson <rwatson@FreeBSD.org>2003-05-12 14:37:47 +0000
commitc21d149f29c38c8ba5f7b5a459b8087f179b6e0c (patch)
treec18fdc38afe72cccc47b907170cbd817b1c16198 /sys/kern/vfs_subr.c
parent47dcc36fd06a006106b0e02663b524bb0d874ac5 (diff)
downloadFreeBSD-src-c21d149f29c38c8ba5f7b5a459b8087f179b6e0c.zip
FreeBSD-src-c21d149f29c38c8ba5f7b5a459b8087f179b6e0c.tar.gz
Remove bogus locking from DDB's "show lockedvnods" command: using
synchronization primitives from inside DDB is generally a bad idea, and in this case it frequently results in panics due to DDB commands being executed from the sio fast interrupt context on a serial console. Replace the locking with a note that a lack of locking means that DDB may get see inconsistent views of the mount and vnode lists, which could also result in a panic. More frequently, though, this avoids a panic than causes it. Discussed with ages ago: bde Approved by: re (scottl)
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index e5cd0bb..66f7271 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -2881,28 +2881,24 @@ vprint(label, vp)
*/
DB_SHOW_COMMAND(lockedvnods, lockedvnodes)
{
- struct thread *td = curthread; /* XXX */
struct mount *mp, *nmp;
struct vnode *vp;
+ /*
+ * Note: because this is DDB, we can't obey the locking semantics
+ * for these structures, which means we could catch an inconsistent
+ * state and dereference a nasty pointer. Not much to be done
+ * about that.
+ */
printf("Locked vnodes\n");
- mtx_lock(&mountlist_mtx);
for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
- if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, td)) {
- nmp = TAILQ_NEXT(mp, mnt_list);
- continue;
- }
- mtx_lock(&mntvnode_mtx);
+ nmp = TAILQ_NEXT(mp, mnt_list);
TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) {
if (VOP_ISLOCKED(vp, NULL))
vprint(NULL, vp);
}
- mtx_unlock(&mntvnode_mtx);
- mtx_lock(&mountlist_mtx);
nmp = TAILQ_NEXT(mp, mnt_list);
- vfs_unbusy(mp, td);
}
- mtx_unlock(&mountlist_mtx);
}
#endif
OpenPOWER on IntegriCloud