diff options
author | David Greenman <dg@FreeBSD.org> | 1995-05-21 21:39:31 +0000 |
---|---|---|
committer | David Greenman <dg@FreeBSD.org> | 1995-05-21 21:39:31 +0000 |
commit | 61f5d510623c7fd6aa5335cf8c5b785915365c8d (patch) | |
tree | 07e1ad65c2ce70cb5c077eecec53a0a1544d9f49 /sys/kern/vfs_subr.c | |
parent | d6f9f66840bc9b9f0007c1f89139a2d653ef767a (diff) | |
download | src-61f5d510623c7fd6aa5335cf8c5b785915365c8d.tar.gz src-61f5d510623c7fd6aa5335cf8c5b785915365c8d.zip |
Changes to fix the following bugs:
1) Files weren't properly synced on filesystems other than UFS. In some
cases, this lead to lost data. Most likely would be noticed on NFS.
The fix is to make the VM page sync/object_clean general rather than
in each filesystem.
2) Mixing regular and mmaped file I/O on NFS was very broken. It caused
chunks of files to end up as zeroes rather than the intended contents.
The fix was to fix several race conditions and to kludge up the
"b_dirtyoff" and "b_dirtyend" that NFS relies upon - paying attention
to page modifications that occurred via the mmapping.
Reviewed by: David Greenman
Submitted by: John Dyson
Notes
Notes:
svn path=/head/; revision=8692
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0998a81640c1..710b3cb9dd7a 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.28 1995/04/16 11:33:33 davidg Exp $ + * $Id: vfs_subr.c,v 1.29 1995/05/12 04:24:53 davidg Exp $ */ /* @@ -1513,3 +1513,31 @@ vfs_export_lookup(mp, nep, nam) } return (np); } + + +/* + * perform msync on all vnodes under a mount point + * the mount point must be locked. + */ +void +vfs_msync(struct mount *mp, int flags) { + struct vnode *vp; +loop: + for (vp = mp->mnt_vnodelist.lh_first; + vp != NULL; + vp = vp->v_mntvnodes.le_next) { + + if (vp->v_mount != mp) + goto loop; + if (VOP_ISLOCKED(vp) && (flags != MNT_WAIT)) + continue; + if (vp->v_vmdata && + (((vm_object_t) vp->v_vmdata)->flags & OBJ_WRITEABLE)) { + if (vget(vp, 1)) + goto loop; + _vm_object_page_clean( (vm_object_t) vp->v_vmdata, + 0, 0, TRUE); + vput(vp); + } + } +} |