Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a301b777714087ea1d63dbec0173a13d416cd7a9
Commit:     a301b777714087ea1d63dbec0173a13d416cd7a9
Parent:     b0c4fddca2bc3967381b728732a8850de35e1b20
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 6 11:07:15 2007 -0800
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Mon Feb 12 22:40:38 2007 -0800

    NFS: Don't use ClearPageUptodate() when writeback fails
    
    ClearPageUptodate() will just cause races here. What we really want to do
    is to invalidate the page cache.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/write.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index dea1737..febdade 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -153,6 +153,13 @@ static void nfs_grow_file(struct page *page, unsigned int 
offset, unsigned int c
        i_size_write(inode, end);
 }
 
+/* A writeback failed: mark the page as bad, and invalidate the page cache */
+static void nfs_set_pageerror(struct page *page)
+{
+       SetPageError(page);
+       nfs_zap_mapping(page->mapping->host, page->mapping);
+}
+
 /* We can set the PG_uptodate flag if we see that a write request
  * covers the full page.
  */
@@ -714,7 +721,7 @@ int nfs_updatepage(struct file *file, struct page *page,
         dprintk("NFS:      nfs_updatepage returns %d (isize %Ld)\n",
                        status, (long long)i_size_read(inode));
        if (status < 0)
-               ClearPageUptodate(page);
+               nfs_set_pageerror(page);
        return status;
 }
 
@@ -976,8 +983,7 @@ static void nfs_writeback_done_partial(struct rpc_task 
*task, void *calldata)
                return;
 
        if (task->tk_status < 0) {
-               ClearPageUptodate(page);
-               SetPageError(page);
+               nfs_set_pageerror(page);
                req->wb_context->error = task->tk_status;
                dprintk(", error = %d\n", task->tk_status);
        } else {
@@ -1034,8 +1040,7 @@ static void nfs_writeback_done_full(struct rpc_task 
*task, void *calldata)
                        (long long)req_offset(req));
 
                if (task->tk_status < 0) {
-                       ClearPageUptodate(page);
-                       SetPageError(page);
+                       nfs_set_pageerror(page);
                        req->wb_context->error = task->tk_status;
                        end_page_writeback(page);
                        nfs_inode_remove_request(req);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to