summaryrefslogtreecommitdiffstats
path: root/sys/dev/vn
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-01-27 00:01:31 +0000
committerjhb <jhb@FreeBSD.org>2001-01-27 00:01:31 +0000
commitb6baa60b1e807d09641c20b2ff1fe838ddebbd3b (patch)
tree81781cbbf3ad98f73e64d11188dfe3084b844e12 /sys/dev/vn
parent0c5b7b7672ac24978496b6d8b72a9f4c74349b64 (diff)
downloadFreeBSD-src-b6baa60b1e807d09641c20b2ff1fe838ddebbd3b.zip
FreeBSD-src-b6baa60b1e807d09641c20b2ff1fe838ddebbd3b.tar.gz
Back out proc locking to protect p_ucred for obtaining additional
references along with the actual obtaining of additional references.
Diffstat (limited to 'sys/dev/vn')
-rw-r--r--sys/dev/vn/vn.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index d11b6ed..570b926 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -562,7 +562,6 @@ vniocattach_file(vn, vio, dev, flag, p)
struct proc *p;
{
struct vattr vattr;
- struct ucred *uc;
struct nameidata nd;
int error, flags;
@@ -579,15 +578,10 @@ vniocattach_file(vn, vio, dev, flag, p)
return (error);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
if (nd.ni_vp->v_type != VREG ||
- (error = VOP_GETATTR(nd.ni_vp, &vattr, uc, p))) {
+ (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p))) {
VOP_UNLOCK(nd.ni_vp, 0, p);
- (void) vn_close(nd.ni_vp, flags, uc, p);
- crfree(uc);
+ (void) vn_close(nd.ni_vp, flags, p->p_ucred, p);
return (error ? error : EINVAL);
}
VOP_UNLOCK(nd.ni_vp, 0, p);
@@ -602,13 +596,11 @@ vniocattach_file(vn, vio, dev, flag, p)
vn->sc_size = (quad_t)vio->vn_size * PAGE_SIZE / vn->sc_secsize;
else
vn->sc_size = vattr.va_size / vn->sc_secsize;
- error = vnsetcred(vn, uc);
+ error = vnsetcred(vn, p->p_ucred);
if (error) {
- (void) vn_close(nd.ni_vp, flags, uc, p);
- crfree(uc);
+ (void) vn_close(nd.ni_vp, flags, p->p_ucred, p);
return(error);
}
- crfree(uc);
vn->sc_flags |= VNF_INITED;
if (flags == FREAD)
vn->sc_flags |= VNF_READONLY;
@@ -635,7 +627,6 @@ vniocattach_swap(vn, vio, dev, flag, p)
struct proc *p;
{
int error;
- struct ucred *uc;
/*
* Range check. Disallow negative sizes or any size less then the
@@ -667,12 +658,7 @@ vniocattach_swap(vn, vio, dev, flag, p)
}
}
vn->sc_flags |= VNF_INITED;
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
- error = vnsetcred(vn, uc);
- crfree(uc);
+ error = vnsetcred(vn, p->p_ucred);
if (error == 0) {
IFOPT(vn, VN_FOLLOW) {
printf("vnioctl: SET vp %p size %x\n",
OpenPOWER on IntegriCloud