diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:02 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:39 -0500 |
commit | abd3e641d5ef9f836ab2f2b04d80b8619b051531 (patch) | |
tree | 053c82b4c23a5fb419691154879acff3f487923b /fs/nfs/write.c | |
parent | 22905f775dd6a8b73be99826dcad07ceec00244b (diff) |
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: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3107908e5f3f..95d00f9132d0 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -232,19 +232,16 @@ static int nfs_writepage_async(struct nfs_open_context *ctx, | |||
232 | unsigned int offset, unsigned int count) | 232 | unsigned int offset, unsigned int count) |
233 | { | 233 | { |
234 | struct nfs_page *req; | 234 | struct nfs_page *req; |
235 | int status; | ||
236 | 235 | ||
237 | req = nfs_update_request(ctx, inode, page, offset, count); | 236 | req = nfs_update_request(ctx, inode, page, offset, count); |
238 | status = (IS_ERR(req)) ? PTR_ERR(req) : 0; | 237 | if (IS_ERR(req)) |
239 | if (status < 0) | 238 | return PTR_ERR(req); |
240 | goto out; | ||
241 | /* Update file length */ | 239 | /* Update file length */ |
242 | nfs_grow_file(page, offset, count); | 240 | nfs_grow_file(page, offset, count); |
243 | /* Set the PG_uptodate flag? */ | 241 | /* Set the PG_uptodate flag? */ |
244 | nfs_mark_uptodate(page, offset, count); | 242 | nfs_mark_uptodate(page, offset, count); |
245 | nfs_unlock_request(req); | 243 | nfs_unlock_request(req); |
246 | out: | 244 | return 0; |
247 | return status; | ||
248 | } | 245 | } |
249 | 246 | ||
250 | static int wb_priority(struct writeback_control *wbc) | 247 | static int wb_priority(struct writeback_control *wbc) |
@@ -304,11 +301,8 @@ do_it: | |||
304 | lock_kernel(); | 301 | lock_kernel(); |
305 | if (!IS_SYNC(inode) && inode_referenced) { | 302 | if (!IS_SYNC(inode) && inode_referenced) { |
306 | err = nfs_writepage_async(ctx, inode, page, 0, offset); | 303 | err = nfs_writepage_async(ctx, inode, page, 0, offset); |
307 | if (err >= 0) { | 304 | if (!wbc->for_writepages) |
308 | err = 0; | 305 | nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); |
309 | if (wbc->for_reclaim) | ||
310 | nfs_flush_inode(inode, 0, 0, FLUSH_STABLE); | ||
311 | } | ||
312 | } else { | 306 | } else { |
313 | err = nfs_writepage_sync(ctx, inode, page, 0, | 307 | err = nfs_writepage_sync(ctx, inode, page, 0, |
314 | offset, priority); | 308 | offset, priority); |