From e887950a45fbab4c4d089c379b35fca10414d51f Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sat, 28 Oct 1995 08:50:08 +0000 Subject: [PATCH] Call vfs_unbusy() before error returns from sysctl_vnode(). This fixes PR 795. Set the size before one error return from sysctl_vnode() the same as before the other. The caller might want to know about the amount successfully read although the current caller doesn't. --- sys/kern/vfs_export.c | 10 +++++++--- sys/kern/vfs_subr.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 7cd54e5542af..d6c1cc0621a2 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 - * $Id: vfs_subr.c,v 1.35 1995/08/11 11:31:07 davidg Exp $ + * $Id: vfs_subr.c,v 1.36 1995/08/25 20:49:44 bde Exp $ */ /* @@ -1315,12 +1315,16 @@ sysctl_vnode(where, sizep) goto again; } if (bp + VPTRSZ + VNODESZ > ewhere) { + vfs_unbusy(mp); *sizep = bp - where; return (ENOMEM); } - if ((error = copyout((caddr_t) &vp, bp, VPTRSZ)) || - (error = copyout((caddr_t) vp, bp + VPTRSZ, VNODESZ))) + if ((error = copyout(&vp, bp, VPTRSZ)) || + (error = copyout(vp, bp + VPTRSZ, VNODESZ))) { + vfs_unbusy(mp); + *sizep = bp - where; return (error); + } bp += VPTRSZ + VNODESZ; } vfs_unbusy(mp); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7cd54e5542af..d6c1cc0621a2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 - * $Id: vfs_subr.c,v 1.35 1995/08/11 11:31:07 davidg Exp $ + * $Id: vfs_subr.c,v 1.36 1995/08/25 20:49:44 bde Exp $ */ /* @@ -1315,12 +1315,16 @@ sysctl_vnode(where, sizep) goto again; } if (bp + VPTRSZ + VNODESZ > ewhere) { + vfs_unbusy(mp); *sizep = bp - where; return (ENOMEM); } - if ((error = copyout((caddr_t) &vp, bp, VPTRSZ)) || - (error = copyout((caddr_t) vp, bp + VPTRSZ, VNODESZ))) + if ((error = copyout(&vp, bp, VPTRSZ)) || + (error = copyout(vp, bp + VPTRSZ, VNODESZ))) { + vfs_unbusy(mp); + *sizep = bp - where; return (error); + } bp += VPTRSZ + VNODESZ; } vfs_unbusy(mp);