diff options
author | alfred <alfred@FreeBSD.org> | 2002-03-15 08:03:46 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-03-15 08:03:46 +0000 |
commit | b0fd50345a3289e9bb8d558d427d688f80e93c0b (patch) | |
tree | 79b2481021420dbb65f469bde8de9f78a99e15a3 /sys/kern/vfs_vnops.c | |
parent | 2609492c806a011026054da1d551410de94ea04c (diff) | |
download | FreeBSD-src-b0fd50345a3289e9bb8d558d427d688f80e93c0b.zip FreeBSD-src-b0fd50345a3289e9bb8d558d427d688f80e93c0b.tar.gz |
Giant pushdown for read/write/pread/pwrite syscalls.
kern/kern_descrip.c:
Aquire Giant in fdrop_locked when file refcount hits zero, this removes
the requirement for the caller to own Giant for the most part.
kern/kern_ktrace.c:
Aquire Giant in ktrgenio, simplifies locking in upper read/write syscalls.
kern/vfs_bio.c:
Aquire Giant in bwillwrite if needed.
kern/sys_generic.c
Giant pushdown, remove Giant for:
read, pread, write and pwrite.
readv and writev aren't done yet because of the possible malloc calls
for iov to uio processing.
kern/sys_socket.c
Grab giant in the socket fo_read/write functions.
kern/vfs_vnops.c
Grab giant in the vnode fo_read/write functions.
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 336086c..4f1556a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -443,6 +443,7 @@ vn_read(fp, uio, cred, flags, td) struct vnode *vp; int error, ioflag; + mtx_lock(&Giant); KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); vp = (struct vnode *)fp->f_data; @@ -463,6 +464,7 @@ vn_read(fp, uio, cred, flags, td) fp->f_offset = uio->uio_offset; fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0, td); + mtx_unlock(&Giant); return (error); } @@ -481,6 +483,7 @@ vn_write(fp, uio, cred, flags, td) struct mount *mp; int error, ioflag; + mtx_lock(&Giant); KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); vp = (struct vnode *)fp->f_data; @@ -498,8 +501,10 @@ vn_write(fp, uio, cred, flags, td) ioflag |= IO_SYNC; mp = NULL; if (vp->v_type != VCHR && - (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) + (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) { + mtx_unlock(&Giant); return (error); + } VOP_LEASE(vp, td, cred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if ((flags & FOF_OFFSET) == 0) @@ -511,6 +516,7 @@ vn_write(fp, uio, cred, flags, td) fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0, td); vn_finished_write(mp); + mtx_unlock(&Giant); return (error); } |