summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Herranz <albert_herranz@yahoo.es>2010-06-04 14:14:57 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-06-04 15:21:45 -0700
commitd6d03f9158516b50d0d343158e3f33bcff1e4ca5 (patch)
treeb853410433ef654e6a152804aa5dd2837cc0a2d7
parent3f505ca45735c35576dab4ceb3e3736d528b6672 (diff)
fb_defio: redo fix for non-dirty ptes
As pointed by Nick Piggin, ->page_mkwrite provides a way to keep a page locked until the associated PTE is marked dirty. Re-implement the fix by using this mechanism. Signed-off-by: Albert Herranz <albert_herranz@yahoo.es> Acked-by: Jaya Kumar <jayakumar.lkml@gmail.com> Acked-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/fb_defio.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 137100ea8ad7..6b93ef93cb12 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -100,6 +100,16 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
/* protect against the workqueue changing the page list */
mutex_lock(&fbdefio->lock);
+ /*
+ * We want the page to remain locked from ->page_mkwrite until
+ * the PTE is marked dirty to avoid page_mkclean() being called
+ * before the PTE is updated, which would leave the page ignored
+ * by defio.
+ * Do this by locking the page here and informing the caller
+ * about it with VM_FAULT_LOCKED.
+ */
+ lock_page(page);
+
/* we loop through the pagelist before adding in order
to keep the pagelist sorted */
list_for_each_entry(cur, &fbdefio->pagelist, lru) {
@@ -121,7 +131,7 @@ page_already_added:
/* come back after delay to process the deferred IO */
schedule_delayed_work(&info->deferred_work, fbdefio->delay);
- return 0;
+ return VM_FAULT_LOCKED;
}
static const struct vm_operations_struct fb_deferred_io_vm_ops = {