Skip to contentSkip to conversation

NFS: Fix NFS page_state usage

PATCH New Trond Myklebust 1 participant 2 messages Jun 26, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 NFS: Fix NFS page_state usage

From: Trond Myklebust <[email protected]>

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().

---

 fs/nfs/write.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/write.c +1 -1
index b383fdd..d054f12 100644
@@ -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 = {

Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw

PATCH 2/2 NFS: missing set_page_writeback()/end_page_writeback() in nfs_cancel_requests

From: Trond Myklebust <[email protected]>

---

 fs/nfs/write.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
fs/nfs/write.c +19 -3
index d054f12..fe3eb36 100644
@@ -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;
 		}

Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs