summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pstat
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2020-01-10 10:33:34 +0000
committerbluhm <bluhm@openbsd.org>2020-01-10 10:33:34 +0000
commita2b5c9223fbb51c0665feb9eb51bd2ebf1a05e29 (patch)
treeb2c095c621308b9efed08cb4d534953d549765ab /usr.sbin/pstat
parentusbd_request_async() already frees 'xfer' in case of an error (diff)
downloadwireguard-openbsd-a2b5c9223fbb51c0665feb9eb51bd2ebf1a05e29.tar.xz
wireguard-openbsd-a2b5c9223fbb51c0665feb9eb51bd2ebf1a05e29.zip
Convert the vnode list at the mount point into a tailq. During
unmount this list is traversed and the dirty vnodes are flushed to disk. Forced unmount expects that the list is empty after flushing, otherwise the kernel panics with "dangling vnode". As the write to disk can sleep, new vnodes may be inserted. If softdep is enabled, resolving the dependencies creates new dirty vnodes and inserts them to the list. To fix the panic, let insmntque() insert new vnodes at the tail of the list. Then vflush() will still catch them while traversing the list in forward direction. OK tedu@ millert@ visa@
Diffstat (limited to 'usr.sbin/pstat')
-rw-r--r--usr.sbin/pstat/pstat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index 1684975c57f..e912817aaf6 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pstat.c,v 1.121 2019/02/05 02:17:32 deraadt Exp $ */
+/* $OpenBSD: pstat.c,v 1.122 2020/01/10 10:33:35 bluhm Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
@@ -855,8 +855,7 @@ kinfo_vnodes(void)
for (mp = TAILQ_FIRST(&kvm_mountlist); mp != NULL;
mp = TAILQ_NEXT(&mount, mnt_list)) {
KGETRET(mp, &mount, sizeof(mount), "mount entry");
- for (vp = LIST_FIRST(&mount.mnt_vnodelist);
- vp != NULL; vp = LIST_NEXT(&vnode, v_mntvnodes)) {
+ TAILQ_FOREACH(vp, &mount.mnt_vnodelist, v_mntvnodes) {
KGETRET(vp, &vnode, sizeof(vnode), "vnode");
if ((bp + sizeof(struct vnode *) +
sizeof(struct vnode)) > evbuf)