Re: msync(2) bug(?), returns AOP_WRITEPAGE_ACTIVATE to userland

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Thursday, October 11, 2007 - 2:47 pm

On Sun, 7 Oct 2007 15:20:19 -0400
Erez Zadok <ezk@cs.sunysb.edu> wrote:


shit.  That's a nasty bug.  Really userspace should be testing for -1, but
the msync() library function should only ever return 0 or -1.

Does this fix it?

--- a/mm/page-writeback.c~a
+++ a/mm/page-writeback.c
@@ -850,8 +850,10 @@ retry:
 
 			ret = (*writepage)(page, wbc, data);
 
-			if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE))
+			if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) {
 				unlock_page(page);
+				ret = 0;
+			}
 			if (ret || (--(wbc->nr_to_write) <= 0))
 				done = 1;
 			if (wbc->nonblocking && bdi_write_congested(bdi)) {
_

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: msync(2) bug(?), returns AOP_WRITEPAGE_ACTIVATE to use ..., Andrew Morton, (Thu Oct 11, 2:47 pm)
[PATCH] fix tmpfs BUG and AOP_WRITEPAGE_ACTIVATE, Hugh Dickins, (Wed Oct 24, 2:02 pm)
Re: [PATCH] fix tmpfs BUG and AOP_WRITEPAGE_ACTIVATE, Andrew Morton, (Wed Oct 24, 2:08 pm)