]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NFS: Don't mark a written page as uptodate until it is on disk
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 19 May 2007 15:58:03 +0000 (11:58 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 11 Jul 2007 03:40:23 +0000 (23:40 -0400)
The write may fail, so we should not mark the page as uptodate until we are
certain that the data has been accepted and written to disk by the server.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/write.c

index af344a158e0103465ab632274e88b9583b69c5aa..b853959d964d2fdd044c41ffcfd9d5c222977d0d 100644 (file)
@@ -191,8 +191,6 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page,
        }
        /* Update file length */
        nfs_grow_file(page, offset, count);
-       /* Set the PG_uptodate flag? */
-       nfs_mark_uptodate(page, offset, count);
        nfs_unlock_request(req);
        return 0;
 }
@@ -751,7 +749,12 @@ int nfs_updatepage(struct file *file, struct page *page,
 static void nfs_writepage_release(struct nfs_page *req)
 {
 
-       if (PageError(req->wb_page) || !nfs_reschedule_unstable_write(req)) {
+       if (PageError(req->wb_page)) {
+               nfs_end_page_writeback(req->wb_page);
+               nfs_inode_remove_request(req);
+       } else if (!nfs_reschedule_unstable_write(req)) {
+               /* Set the PG_uptodate flag */
+               nfs_mark_uptodate(req->wb_page, req->wb_pgbase, req->wb_bytes);
                nfs_end_page_writeback(req->wb_page);
                nfs_inode_remove_request(req);
        } else
@@ -1039,6 +1042,8 @@ static void nfs_writeback_done_full(struct rpc_task *task, void *calldata)
                        dprintk(" marked for commit\n");
                        goto next;
                }
+               /* Set the PG_uptodate flag? */
+               nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes);
                dprintk(" OK\n");
 remove_request:
                nfs_end_page_writeback(page);
@@ -1249,6 +1254,9 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
                 * returned by the server against all stored verfs. */
                if (!memcmp(req->wb_verf.verifier, data->verf.verifier, sizeof(data->verf.verifier))) {
                        /* We have a match */
+                       /* Set the PG_uptodate flag */
+                       nfs_mark_uptodate(req->wb_page, req->wb_pgbase,
+                                       req->wb_bytes);
                        nfs_inode_remove_request(req);
                        dprintk(" OK\n");
                        goto next;