Commit abd3e641 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Work correctly with single-page ->writepage() calls

 Ensure that we always initiate flushing of data before we exit
 a single-page ->writepage() call.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 22905f77
...@@ -232,19 +232,16 @@ static int nfs_writepage_async(struct nfs_open_context *ctx, ...@@ -232,19 +232,16 @@ static int nfs_writepage_async(struct nfs_open_context *ctx,
unsigned int offset, unsigned int count) unsigned int offset, unsigned int count)
{ {
struct nfs_page *req; struct nfs_page *req;
int status;
req = nfs_update_request(ctx, inode, page, offset, count); req = nfs_update_request(ctx, inode, page, offset, count);
status = (IS_ERR(req)) ? PTR_ERR(req) : 0; if (IS_ERR(req))
if (status < 0) return PTR_ERR(req);
goto out;
/* Update file length */ /* Update file length */
nfs_grow_file(page, offset, count); nfs_grow_file(page, offset, count);
/* Set the PG_uptodate flag? */ /* Set the PG_uptodate flag? */
nfs_mark_uptodate(page, offset, count); nfs_mark_uptodate(page, offset, count);
nfs_unlock_request(req); nfs_unlock_request(req);
out: return 0;
return status;
} }
static int wb_priority(struct writeback_control *wbc) static int wb_priority(struct writeback_control *wbc)
...@@ -304,11 +301,8 @@ do_it: ...@@ -304,11 +301,8 @@ do_it:
lock_kernel(); lock_kernel();
if (!IS_SYNC(inode) && inode_referenced) { if (!IS_SYNC(inode) && inode_referenced) {
err = nfs_writepage_async(ctx, inode, page, 0, offset); err = nfs_writepage_async(ctx, inode, page, 0, offset);
if (err >= 0) { if (!wbc->for_writepages)
err = 0; nfs_flush_inode(inode, 0, 0, wb_priority(wbc));
if (wbc->for_reclaim)
nfs_flush_inode(inode, 0, 0, FLUSH_STABLE);
}
} else { } else {
err = nfs_writepage_sync(ctx, inode, page, 0, err = nfs_writepage_sync(ctx, inode, page, 0,
offset, priority); offset, priority);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment