summaryrefslogtreecommitdiffstats
path: root/sys/vm/vnode_pager.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-06-01 21:00:28 +0000
committerkib <kib@FreeBSD.org>2011-06-01 21:00:28 +0000
commitad5bd0652340908efab201a5a95766c83a96160a (patch)
tree07e1defe92d7e0b4f536a6246e42367ce49158b2 /sys/vm/vnode_pager.c
parentfa6dbdd4a2c067d514a8442f406a37ad52fb9be7 (diff)
downloadFreeBSD-src-ad5bd0652340908efab201a5a95766c83a96160a.zip
FreeBSD-src-ad5bd0652340908efab201a5a95766c83a96160a.tar.gz
In the VOP_PUTPAGES() implementations, change the default error from
VM_PAGER_AGAIN to VM_PAGER_ERROR for the uwritten pages. Return VM_PAGER_AGAIN for the partially written page. Always forward at least one page in the loop of vm_object_page_clean(). VM_PAGER_ERROR causes the page reactivation and does not clear the page dirty state, so the write is not lost. The change fixes an infinite loop in vm_object_page_clean() when the filesystem returns permanent errors for some page writes. Reported and tested by: gavin Reviewed by: alc, rmacklem MFC after: 1 week
Diffstat (limited to 'sys/vm/vnode_pager.c')
-rw-r--r--sys/vm/vnode_pager.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index f497d41..98a5be0 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -1089,7 +1089,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
count = bytecount / PAGE_SIZE;
for (i = 0; i < count; i++)
- rtvals[i] = VM_PAGER_AGAIN;
+ rtvals[i] = VM_PAGER_ERROR;
if ((int64_t)ma[0]->pindex < 0) {
printf("vnode_pager_putpages: attempt to write meta-data!!! -- 0x%lx(%lx)\n",
@@ -1191,3 +1191,20 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
}
return rtvals[0];
}
+
+void
+vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written)
+{
+ int i, pos;
+
+ for (i = 0, pos = 0; pos < written; i++, pos += PAGE_SIZE) {
+ if (pos < trunc_page(written)) {
+ rtvals[i] = VM_PAGER_OK;
+ vm_page_undirty(ma[i]);
+ } else {
+ /* Partially written page. */
+ rtvals[i] = VM_PAGER_AGAIN;
+ vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK);
+ }
+ }
+}
OpenPOWER on IntegriCloud