diff options
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d83498282837..4ef454763886 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -65,13 +65,18 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr) | |||
65 | 65 | ||
66 | int nfs_write_inode(struct inode *inode, int sync) | 66 | int nfs_write_inode(struct inode *inode, int sync) |
67 | { | 67 | { |
68 | int flags = sync ? FLUSH_SYNC : 0; | ||
69 | int ret; | 68 | int ret; |
70 | 69 | ||
71 | ret = nfs_commit_inode(inode, flags); | 70 | if (sync) { |
72 | if (ret < 0) | 71 | ret = filemap_fdatawait(inode->i_mapping); |
73 | return ret; | 72 | if (ret == 0) |
74 | return 0; | 73 | ret = nfs_commit_inode(inode, FLUSH_SYNC); |
74 | } else | ||
75 | ret = nfs_commit_inode(inode, 0); | ||
76 | if (ret >= 0) | ||
77 | return 0; | ||
78 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
79 | return ret; | ||
75 | } | 80 | } |
76 | 81 | ||
77 | void nfs_clear_inode(struct inode *inode) | 82 | void nfs_clear_inode(struct inode *inode) |