login
Header Space

 
 

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

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ryan Finnie <ryan@...>
Cc: Andrew Morton <akpm@...>, Erez Zadok <ezk@...>, <linux-kernel@...>, <linux-fsdevel@...>, <cjwatson@...>, <linux-mm@...>
Date: Thursday, October 11, 2007 - 8:38 pm

On Thu, 11 Oct 2007, Ryan Finnie wrote:

Each time I sit down to follow what's going on with writepage and
unionfs and msync, I get distracted: I really haven't researched
this properly.

But I keep suspecting that the answer might be the patch below (which
rather follows what drivers/block/rd.c is doing).  I'm especially
worried that, rather than just AOP_WRITEPAGE_ACTIVATE being returned
to userspace, bad enough in itself, you might be liable to hit that
BUG_ON(page_mapped(page)).  shmem_writepage does not expect to be
called by anyone outside mm/vmscan.c, but unionfs can now get to it?

Please let us know if this patch does fix it:
then I'll try harder to work out what goes on.

Thanks,
Hugh

--- 2.6.23/mm/shmem.c	2007-10-09 21:31:38.000000000 +0100
+++ linux/mm/shmem.c	2007-10-12 01:25:46.000000000 +0100
@@ -916,6 +916,11 @@ static int shmem_writepage(struct page *
 	struct inode *inode;
 
 	BUG_ON(!PageLocked(page));
+	if (!wbc->for_reclaim) {
+		set_page_dirty(page);
+		unlock_page(page);
+		return 0;
+	}
 	BUG_ON(page_mapped(page));
 
 	mapping = page->mapping;
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

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