summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-05-08 09:03:58 +0000
committermpi <mpi@openbsd.org>2018-05-08 09:03:58 +0000
commit19ca50e9de34282694fd388af0327a6af8ca8dd2 (patch)
tree9caed16d64469171445a1d7029adc0db812e5ef7
parentMove the vfs stall "barrier" logic to a function. FREF() will soon (diff)
downloadwireguard-openbsd-19ca50e9de34282694fd388af0327a6af8ca8dd2.tar.xz
wireguard-openbsd-19ca50e9de34282694fd388af0327a6af8ca8dd2.zip
Change fd_iterfile() to not return imature fps instead of skipping them
later. ok bluhm@, visa@
-rw-r--r--sys/kern/kern_descrip.c4
-rw-r--r--sys/kern/kern_sysctl.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index fc971435284..1d0e4b73edf 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.157 2018/05/08 08:53:41 mpi Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.158 2018/05/08 09:03:58 mpi Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -190,7 +190,7 @@ fd_iterfile(struct file *fp, struct proc *p)
nfp = LIST_NEXT(fp, f_list);
/* don't FREF when f_count == 0 to avoid race in fdrop() */
- while (nfp != NULL && nfp->f_count == 0)
+ while (nfp != NULL && (nfp->f_count == 0 || !FILE_IS_USABLE(nfp)))
nfp = LIST_NEXT(nfp, f_list);
if (nfp != NULL)
FREF(nfp);
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 3ac0efa3fdf..07d5e1f4c5e 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.334 2018/05/08 08:53:41 mpi Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.335 2018/05/08 09:03:58 mpi Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1322,9 +1322,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
}
fp = NULL;
while ((fp = fd_iterfile(fp, p)) != NULL) {
- if (fp->f_count > 1 && /* 0, +1 for our FREF() */
- FILE_IS_USABLE(fp) &&
- (arg == 0 || fp->f_type == arg)) {
+ if ((arg == 0 || fp->f_type == arg)) {
int af, skip = 0;
if (arg == DTYPE_SOCKET && fp->f_type == arg) {
af = ((struct socket *)fp->f_data)->