diff options
author | alfred <alfred@FreeBSD.org> | 2001-05-19 01:28:09 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2001-05-19 01:28:09 +0000 |
commit | a3f0842419d98da211706f921fc626e160cd960b (patch) | |
tree | e86922a5639c32e1242d4f3088fc487f3be5b236 /sys/nfs | |
parent | 9eda9187f024233436e6a743f13bd938b1a0f19c (diff) | |
download | FreeBSD-src-a3f0842419d98da211706f921fc626e160cd960b.zip FreeBSD-src-a3f0842419d98da211706f921fc626e160cd960b.tar.gz |
Introduce a global lock for the vm subsystem (vm_mtx).
vm_mtx does not recurse and is required for most low level
vm operations.
faults can not be taken without holding Giant.
Memory subsystems can now call the base page allocators safely.
Almost all atomic ops were removed as they are covered under the
vm mutex.
Alpha and ia64 now need to catch up to i386's trap handlers.
FFS and NFS have been tested, other filesystems will need minor
changes (grabbing the vm lock when twiddling page properties).
Reviewed (partially) by: jake, jhb
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_bio.c | 31 | ||||
-rw-r--r-- | sys/nfs/nfs_common.c | 2 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 2 |
3 files changed, 32 insertions, 3 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index cb7297f..234815c 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -124,8 +124,13 @@ nfs_getpages(ap) } if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 && - (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) + (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) { + mtx_unlock(&vm_mtx); + mtx_lock(&Giant); (void)nfs_fsinfo(nmp, vp, cred, p); + mtx_unlock(&Giant); + mtx_lock(&vm_mtx); + } npages = btoc(count); @@ -168,7 +173,11 @@ nfs_getpages(ap) uio.uio_rw = UIO_READ; uio.uio_procp = p; + mtx_unlock(&vm_mtx); + mtx_lock(&Giant); error = nfs_readrpc(vp, &uio, cred); + mtx_unlock(&Giant); + mtx_lock(&vm_mtx); pmap_qremove(kva, npages); relpbuf(bp, &nfs_pbuf_freecnt); @@ -280,8 +289,13 @@ nfs_putpages(ap) offset = IDX_TO_OFF(pages[0]->pindex); if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 && - (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) + (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) { + mtx_unlock(&vm_mtx); + mtx_lock(&Giant); (void)nfs_fsinfo(nmp, vp, cred, p); + mtx_unlock(&Giant); + mtx_lock(&vm_mtx); + } for (i = 0; i < npages; i++) { rtvals[i] = VM_PAGER_AGAIN; @@ -321,7 +335,11 @@ nfs_putpages(ap) else iomode = NFSV3WRITE_FILESYNC; + mtx_unlock(&vm_mtx); + mtx_lock(&Giant); error = nfs_writerpc(vp, &uio, cred, &iomode, &must_commit); + mtx_unlock(&Giant); + mtx_lock(&vm_mtx); pmap_qremove(kva, npages); relpbuf(bp, &nfs_pbuf_freecnt); @@ -332,8 +350,13 @@ nfs_putpages(ap) rtvals[i] = VM_PAGER_OK; vm_page_undirty(pages[i]); } - if (must_commit) + if (must_commit) { + mtx_unlock(&vm_mtx); + mtx_lock(&Giant); nfs_clearcommit(vp->v_mount); + mtx_unlock(&Giant); + mtx_lock(&vm_mtx); + } } return rtvals[0]; } @@ -1076,7 +1099,9 @@ again: bp->b_dirtyoff = on; bp->b_dirtyend = on + n; } + mtx_lock(&vm_mtx); vfs_bio_set_validclean(bp, on, n); + mtx_unlock(&vm_mtx); } /* diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index c7e6917..18cb8a9 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -2139,6 +2139,8 @@ nfs_clearcommit(mp) int s; s = splbio(); + mtx_assert(&Giant, MA_OWNED); + mtx_assert(&vm_mtx, MA_NOTOWNED); loop: for (vp = mp->mnt_vnodelist.lh_first; vp; vp = nvp) { if (vp->v_mount != mp) /* Paranoia */ diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index c7e6917..18cb8a9 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -2139,6 +2139,8 @@ nfs_clearcommit(mp) int s; s = splbio(); + mtx_assert(&Giant, MA_OWNED); + mtx_assert(&vm_mtx, MA_NOTOWNED); loop: for (vp = mp->mnt_vnodelist.lh_first; vp; vp = nvp) { if (vp->v_mount != mp) /* Paranoia */ |