mirror of
https://github.com/opnsense/src.git
synced 2026-04-23 07:07:24 -04:00
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)
This commit is contained in:
parent
4680667e8d
commit
1964fb9ba2
1 changed files with 7 additions and 11 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue