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: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
1544fa0f7a
commit
b80c3cb628
@ -421,6 +421,7 @@ static void
|
||||
nfs_mark_request_dirty(struct nfs_page *req)
|
||||
{
|
||||
__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)
|
||||
@ -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);
|
||||
if (IS_ERR(req))
|
||||
return PTR_ERR(req);
|
||||
nfs_mark_request_dirty(req);
|
||||
/* Update file length */
|
||||
nfs_grow_file(page, offset, count);
|
||||
nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes);
|
||||
@ -739,8 +741,6 @@ int nfs_updatepage(struct file *file, struct page *page,
|
||||
status = nfs_writepage_setup(ctx, page, offset, count);
|
||||
if (status < 0)
|
||||
nfs_set_pageerror(page);
|
||||
else
|
||||
__set_page_dirty_nobuffers(page);
|
||||
|
||||
dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n",
|
||||
status, (long long)i_size_read(inode));
|
||||
|
Loading…
Reference in New Issue
Block a user