lkml.org 
[lkml]   [2006]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch 6/6] mm: fix pagecache write deadlocks
On Fri, Oct 13, 2006 at 06:44:52PM +0200, Nick Piggin wrote:
> From: Andrew Morton <akpm@osdl.org> and Nick Piggin <npiggin@suse.de>
>
> The idea is to modify the core write() code so that it won't take a pagefault
> while holding a lock on the pagecache page. There are a number of different
> deadlocks possible if we try to do such a thing:

Here is a patch to improve the comment a little. This is a pretty tricky
situation so we must be clear as to why it works.
--

Comment was not entirely clear about why we must eliminate all other
possibilities.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/mm/filemap.c
===================================================================
--- linux-2.6.orig/mm/filemap.c
+++ linux-2.6/mm/filemap.c
@@ -1946,12 +1946,19 @@ retry_noprogress:
if (!PageUptodate(page)) {
/*
* If the page is not uptodate, we cannot allow a
- * partial commit_write, because that might expose
- * uninitialised data.
+ * partial commit_write because when we unlock the
+ * page below, someone else might bring it uptodate
+ * and we lose our write. We cannot allow a full
+ * commit_write, because that exposes uninitialised
+ * data. We cannot zero the rest of the file and do
+ * a full commit_write because that exposes transient
+ * zeroes.
*
- * We will enter the single-segment path below, which
- * should get the filesystem to bring the page
- * uputodate for us next time.
+ * Abort the operation entirely with a zero length
+ * commit_write. Retry. We will enter the
+ * single-segment path below, which should get the
+ * filesystem to bring the page uputodate for us next
+ * time.
*/
if (unlikely(copied != bytes))
copied = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-10-14 07:09    [from the cache]
©2003-2011 Jasper Spaans