linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] NFS: Fix NFS page_state usage
@ 2006-06-26 23:32 Trond Myklebust
  2006-06-26 23:32 ` [PATCH 2/2] NFS: missing set_page_writeback()/end_page_writeback() in nfs_cancel_requests Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2006-06-26 23:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, nfs

From: Trond Myklebust <Trond.Myklebust@netapp.com>

The introduction of the FLUSH_INVALIDATE argument to nfs_sync_inode_wait()
can cause the nr_unstable page state counter to be corrupted. Fix by
moving the call to sub_page_state() to inside nfs_scan_commit().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 fs/nfs/write.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b383fdd..d054f12 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -636,6 +636,7 @@ nfs_scan_commit(struct inode *inode, str
 	if (nfsi->ncommit != 0) {
 		res = nfs_scan_list(nfsi, &nfsi->commit, dst, idx_start, npages);
 		nfsi->ncommit -= res;
+		sub_page_state(nr_unstable,res);
 		if ((nfsi->ncommit == 0) != list_empty(&nfsi->commit))
 			printk(KERN_ERR "NFS: desynchronized value of nfs_i.ncommit.\n");
 	}
@@ -1434,7 +1435,6 @@ static void nfs_commit_done(struct rpc_t
 		nfs_clear_page_writeback(req);
 		res++;
 	}
-	sub_page_state(nr_unstable,res);
 }
 
 static const struct rpc_call_ops nfs_commit_ops = {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] NFS: missing set_page_writeback()/end_page_writeback() in nfs_cancel_requests
  2006-06-26 23:32 [PATCH 1/2] NFS: Fix NFS page_state usage Trond Myklebust
@ 2006-06-26 23:32 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2006-06-26 23:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, nfs

From: Trond Myklebust <Trond.Myklebust@netapp.com>

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 fs/nfs/write.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index d054f12..fe3eb36 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -579,7 +579,23 @@ static int nfs_wait_on_requests(struct i
 	return ret;
 }
 
-static void nfs_cancel_requests(struct list_head *head)
+static void nfs_cancel_dirty_list(struct list_head *head)
+{
+	struct nfs_page *req;
+	while(!list_empty(head)) {
+		req = nfs_list_entry(head->next);
+		nfs_list_remove_request(req);
+		/* Hack, cough, splutter!
+		 * Wretched borken mm requires us to do this...
+		 */
+		set_page_writeback(req->wb_page);
+		end_page_writeback(req->wb_page);
+		nfs_inode_remove_request(req);
+		nfs_clear_page_writeback(req);
+	}
+}
+
+static void nfs_cancel_commit_list(struct list_head *head)
 {
 	struct nfs_page *req;
 	while(!list_empty(head)) {
@@ -1503,7 +1519,7 @@ int nfs_sync_inode_wait(struct inode *in
 		if (pages != 0) {
 			spin_unlock(&nfsi->req_lock);
 			if (how & FLUSH_INVALIDATE)
-				nfs_cancel_requests(&head);
+				nfs_cancel_dirty_list(&head);
 			else
 				ret = nfs_flush_list(inode, &head, pages, how);
 			spin_lock(&nfsi->req_lock);
@@ -1516,7 +1532,7 @@ int nfs_sync_inode_wait(struct inode *in
 			break;
 		if (how & FLUSH_INVALIDATE) {
 			spin_unlock(&nfsi->req_lock);
-			nfs_cancel_requests(&head);
+			nfs_cancel_commit_list(&head);
 			spin_lock(&nfsi->req_lock);
 			continue;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-26 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26 23:32 [PATCH 1/2] NFS: Fix NFS page_state usage Trond Myklebust
2006-06-26 23:32 ` [PATCH 2/2] NFS: missing set_page_writeback()/end_page_writeback() in nfs_cancel_requests Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).