From 4eb5a7d9ee279be7c2af44ea69f761d7ddb4ddaf Mon Sep 17 00:00:00 2001 From: ups Date: Thu, 25 May 2006 01:00:35 +0000 Subject: Do not set B_NOCACHE on buffers when releasing them in flushbuflist(). If B_NOCACHE is set the pages of vm backed buffers will be invalidated. However clean buffers can be backed by dirty VM pages so invalidating them can lead to data loss. Add support for flush dirty page in the data invalidation function of some network file systems. This fixes data losses during vnode recycling (and other code paths using invalbuf(*,V_SAVE,*,*)) for data written using an mmaped file. Collaborative effort by: jhb@,mohans@,peter@,ps@,ups@ Reviewed by: tegge@ MFC after: 7 days --- sys/fs/smbfs/smbfs_io.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/fs/smbfs') diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 478ed55..7e76a87 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -683,6 +683,10 @@ smbfs_vinvalbuf(struct vnode *vp, struct thread *td) return EINTR; } np->n_flag |= NFLUSHINPROG; + + if (vp->v_bufobj.bo_object != NULL) + vm_object_page_clean(vp->v_bufobj.bo_object, 0, 0, OBJPC_SYNC); + error = vinvalbuf(vp, V_SAVE, td, PCATCH, 0); while (error) { if (error == ERESTART || error == EINTR) { -- cgit v1.1