Re: [patch 6/6] mm: fix pagecache write deadlocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 13, 2006 at 06:44:52PM +0200, Nick Piggin wrote:
> From: Andrew Morton <[email protected]> and Nick Piggin <[email protected]>
> 
> 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 <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux