Commit b80c3cb6 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Ensure that writeback_single_inode() calls write_inode() when syncing

Since writeback_single_inode() checks the inode->i_state flags _before_ it
flushes out the data, we need to ensure that the I_DIRTY_DATASYNC flag is
already set. Otherwise we risk not seeing a call to write_inode(), which
again means that we break fsync() et al...
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 1544fa0f
...@@ -421,6 +421,7 @@ static void ...@@ -421,6 +421,7 @@ static void
nfs_mark_request_dirty(struct nfs_page *req) nfs_mark_request_dirty(struct nfs_page *req)
{ {
__set_page_dirty_nobuffers(req->wb_page); __set_page_dirty_nobuffers(req->wb_page);
__mark_inode_dirty(req->wb_page->mapping->host, I_DIRTY_DATASYNC);
} }
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
...@@ -660,6 +661,7 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page, ...@@ -660,6 +661,7 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page,
req = nfs_setup_write_request(ctx, page, offset, count); req = nfs_setup_write_request(ctx, page, offset, count);
if (IS_ERR(req)) if (IS_ERR(req))
return PTR_ERR(req); return PTR_ERR(req);
nfs_mark_request_dirty(req);
/* Update file length */ /* Update file length */
nfs_grow_file(page, offset, count); nfs_grow_file(page, offset, count);
nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes);
...@@ -739,8 +741,6 @@ int nfs_updatepage(struct file *file, struct page *page, ...@@ -739,8 +741,6 @@ int nfs_updatepage(struct file *file, struct page *page,
status = nfs_writepage_setup(ctx, page, offset, count); status = nfs_writepage_setup(ctx, page, offset, count);
if (status < 0) if (status < 0)
nfs_set_pageerror(page); nfs_set_pageerror(page);
else
__set_page_dirty_nobuffers(page);
dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n", dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n",
status, (long long)i_size_read(inode)); status, (long long)i_size_read(inode));
......
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