linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Rik van Riel <riel@redhat.com>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 7/6] Lost bits - fix PG_writeback vs PG_private race in NFS
Date: Fri, 25 Aug 2006 18:36:55 +0200	[thread overview]
Message-ID: <1156523815.16027.43.camel@taijtu> (raw)
In-Reply-To: <20060825153709.24254.28118.sendpatchset@twins>

Make sure we clear PG_writeback after we clear PG_private, otherwise
weird and wonderfull stuff will happen.

Also, teach try_to_release_page() about PG_swapcache pages.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 fs/buffer.c    |    2 +-
 fs/nfs/write.c |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c
+++ linux-2.6/fs/buffer.c
@@ -1567,7 +1567,7 @@ static void discard_buffer(struct buffer
  */
 int try_to_release_page(struct page *page, gfp_t gfp_mask)
 {
-	struct address_space * const mapping = page->mapping;
+	struct address_space * const mapping = page_mapping(page);
 
 	BUG_ON(!PageLocked(page));
 	if (PageWriteback(page))
Index: linux-2.6/fs/nfs/write.c
===================================================================
--- linux-2.6.orig/fs/nfs/write.c
+++ linux-2.6/fs/nfs/write.c
@@ -902,7 +902,6 @@ done:
 
 static void nfs_writepage_release(struct nfs_page *req)
 {
-	end_page_writeback(req->wb_page);
 
 #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
 	if (!PageError(req->wb_page)) {
@@ -922,6 +921,7 @@ out:
 #else
 	nfs_inode_remove_request(req);
 #endif
+	end_page_writeback(req->wb_page);
 	nfs_clear_page_writeback(req);
 }
 
@@ -1222,12 +1222,10 @@ static void nfs_writeback_done_full(stru
 			ClearPageUptodate(page);
 			SetPageError(page);
 			req->wb_context->error = task->tk_status;
-			end_page_writeback(page);
 			nfs_inode_remove_request(req);
 			dprintk(", error = %d\n", task->tk_status);
 			goto next;
 		}
-		end_page_writeback(page);
 
 #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
 		if (data->args.stable != NFS_UNSTABLE || data->verf.committed == NFS_FILE_SYNC) {
@@ -1242,6 +1240,7 @@ static void nfs_writeback_done_full(stru
 		nfs_inode_remove_request(req);
 #endif
 	next:
+		end_page_writeback(page);
 		nfs_clear_page_writeback(req);
 	}
 }


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2006-08-25 16:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25 15:37 [PATCH 0/6] Swap over NFS Peter Zijlstra
2006-08-25 15:37 ` [PATCH 1/6] mm: Generic swap file support Peter Zijlstra
2006-08-25 15:37 ` [PATCH 2/6] mm: New page_file_* methods Peter Zijlstra
2006-08-25 15:37 ` [PATCH 3/6] uml: arch/um remove_mapping() clash Peter Zijlstra
2006-08-29 20:20   ` Jeff Dike
2006-08-25 15:37 ` [PATCH 4/6] nfs: Teach NFS about swap cache pages Peter Zijlstra
2006-08-25 20:03   ` Trond Myklebust
2006-08-25 20:20     ` Peter Zijlstra
2006-08-25 20:37       ` Trond Myklebust
2006-08-25 15:38 ` [PATCH 5/6] nfs: Add comment on PG_private use of NFS Peter Zijlstra
2006-08-25 15:38 ` [PATCH 6/6] nfs: Enable swap over NFS Peter Zijlstra
2006-08-26 14:36   ` Pavel Machek
2006-08-26 17:30     ` Peter Zijlstra
2006-08-26 21:54     ` Rik van Riel
2006-08-25 16:36 ` Peter Zijlstra [this message]
2006-08-25 20:11   ` [PATCH 7/6] Lost bits - fix PG_writeback vs PG_private race in NFS Trond Myklebust
2006-08-25 20:44     ` Peter Zijlstra
2006-08-25 21:19       ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1156523815.16027.43.camel@taijtu \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox