When doing vflush(WRITECLOSE), clean vnode pages.

Unmounts do vfs_msync() before calling VFS_UNMOUNT(), but there is
still a race allowing a process to dirty pages after msync
finished. Remounts rw->ro just left dirty pages in system.

Reviewed by:	alc, tegge (long time ago)
Tested by:	pho
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2012-01-25 20:54:09 +00:00
parent d5210589b7
commit abc942b56c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230553

View file

@ -2496,6 +2496,18 @@ vflush(struct mount *mp, int rootrefs, int flags, struct thread *td)
* vnodes open for writing.
*/
if (flags & WRITECLOSE) {
if (vp->v_object != NULL) {
VM_OBJECT_LOCK(vp->v_object);
vm_object_page_clean(vp->v_object, 0, 0, 0);
VM_OBJECT_UNLOCK(vp->v_object);
}
error = VOP_FSYNC(vp, MNT_WAIT, td);
if (error != 0) {
VOP_UNLOCK(vp, 0);
vdrop(vp);
MNT_VNODE_FOREACH_ABORT(mp, mvp);
return (error);
}
error = VOP_GETATTR(vp, &vattr, td->td_ucred);
VI_LOCK(vp);