diff options
Diffstat (limited to 'fs/nfs/nfs4file.c')
-rw-r--r-- | fs/nfs/nfs4file.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 619eca34e70f..f58c17b3b480 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include "fscache.h" | 10 | #include "fscache.h" |
11 | #include "pnfs.h" | 11 | #include "pnfs.h" |
12 | 12 | ||
13 | #include "nfstrace.h" | ||
14 | |||
13 | #ifdef CONFIG_NFS_V4_2 | 15 | #ifdef CONFIG_NFS_V4_2 |
14 | #include "nfs42.h" | 16 | #include "nfs42.h" |
15 | #endif | 17 | #endif |
@@ -57,7 +59,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) | |||
57 | if (openflags & O_TRUNC) { | 59 | if (openflags & O_TRUNC) { |
58 | attr.ia_valid |= ATTR_SIZE; | 60 | attr.ia_valid |= ATTR_SIZE; |
59 | attr.ia_size = 0; | 61 | attr.ia_size = 0; |
60 | nfs_wb_all(inode); | 62 | nfs_sync_inode(inode); |
61 | } | 63 | } |
62 | 64 | ||
63 | inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened); | 65 | inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened); |
@@ -100,6 +102,9 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
100 | int ret; | 102 | int ret; |
101 | struct inode *inode = file_inode(file); | 103 | struct inode *inode = file_inode(file); |
102 | 104 | ||
105 | trace_nfs_fsync_enter(inode); | ||
106 | |||
107 | nfs_inode_dio_wait(inode); | ||
103 | do { | 108 | do { |
104 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 109 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
105 | if (ret != 0) | 110 | if (ret != 0) |
@@ -107,7 +112,7 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
107 | mutex_lock(&inode->i_mutex); | 112 | mutex_lock(&inode->i_mutex); |
108 | ret = nfs_file_fsync_commit(file, start, end, datasync); | 113 | ret = nfs_file_fsync_commit(file, start, end, datasync); |
109 | if (!ret) | 114 | if (!ret) |
110 | ret = pnfs_layoutcommit_inode(inode, true); | 115 | ret = pnfs_sync_inode(inode, !!datasync); |
111 | mutex_unlock(&inode->i_mutex); | 116 | mutex_unlock(&inode->i_mutex); |
112 | /* | 117 | /* |
113 | * If nfs_file_fsync_commit detected a server reboot, then | 118 | * If nfs_file_fsync_commit detected a server reboot, then |
@@ -118,6 +123,7 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
118 | end = LLONG_MAX; | 123 | end = LLONG_MAX; |
119 | } while (ret == -EAGAIN); | 124 | } while (ret == -EAGAIN); |
120 | 125 | ||
126 | trace_nfs_fsync_exit(inode, ret); | ||
121 | return ret; | 127 | return ret; |
122 | } | 128 | } |
123 | 129 | ||
@@ -152,15 +158,9 @@ static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t | |||
152 | if (ret < 0) | 158 | if (ret < 0) |
153 | return ret; | 159 | return ret; |
154 | 160 | ||
155 | mutex_lock(&inode->i_mutex); | ||
156 | if (mode & FALLOC_FL_PUNCH_HOLE) | 161 | if (mode & FALLOC_FL_PUNCH_HOLE) |
157 | ret = nfs42_proc_deallocate(filep, offset, len); | 162 | return nfs42_proc_deallocate(filep, offset, len); |
158 | else | 163 | return nfs42_proc_allocate(filep, offset, len); |
159 | ret = nfs42_proc_allocate(filep, offset, len); | ||
160 | mutex_unlock(&inode->i_mutex); | ||
161 | |||
162 | nfs_zap_caches(inode); | ||
163 | return ret; | ||
164 | } | 164 | } |
165 | #endif /* CONFIG_NFS_V4_2 */ | 165 | #endif /* CONFIG_NFS_V4_2 */ |
166 | 166 | ||