diff options
author | ups <ups@FreeBSD.org> | 2006-05-25 01:00:35 +0000 |
---|---|---|
committer | ups <ups@FreeBSD.org> | 2006-05-25 01:00:35 +0000 |
commit | 4eb5a7d9ee279be7c2af44ea69f761d7ddb4ddaf (patch) | |
tree | 1d4029c4f5ae89d4fc67d2ec54084eeca9bb5d19 /sys/nfsclient | |
parent | 365e894b0f63e67763498fc8f9ebd33fa3cfa8bf (diff) | |
download | FreeBSD-src-4eb5a7d9ee279be7c2af44ea69f761d7ddb4ddaf.zip FreeBSD-src-4eb5a7d9ee279be7c2af44ea69f761d7ddb4ddaf.tar.gz |
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
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 19228ac..cac2175 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -1312,6 +1312,17 @@ nfs_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg) /* * Now, flush as required. */ + if ((flags & V_SAVE) && (vp->v_bufobj.bo_object != NULL)) { + vm_object_page_clean(vp->v_bufobj.bo_object, 0, 0, OBJPC_SYNC); + /* + * If the page clean was interrupted, fail the invalidation. + * Not doing so, we run the risk of losing dirty pages in the + * vinvalbuf() call below. + */ + if (intrflg && (error = nfs_sigintr(nmp, NULL, td))) + goto out; + } + error = vinvalbuf(vp, flags, td, slpflag, 0); while (error) { if (intrflg && (error = nfs_sigintr(nmp, NULL, td))) |