aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index fa05c027ea11..add289138836 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -127,23 +127,6 @@ nfs_file_release(struct inode *inode, struct file *filp)
127} 127}
128 128
129/** 129/**
130 * nfs_revalidate_file - Revalidate the page cache & related metadata
131 * @inode - pointer to inode struct
132 * @file - pointer to file
133 */
134static int nfs_revalidate_file(struct inode *inode, struct file *filp)
135{
136 struct nfs_inode *nfsi = NFS_I(inode);
137 int retval = 0;
138
139 if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR))
140 || nfs_attribute_timeout(inode))
141 retval = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
142 nfs_revalidate_mapping(inode, filp->f_mapping);
143 return 0;
144}
145
146/**
147 * nfs_revalidate_size - Revalidate the file size 130 * nfs_revalidate_size - Revalidate the file size
148 * @inode - pointer to inode struct 131 * @inode - pointer to inode struct
149 * @file - pointer to struct file 132 * @file - pointer to struct file
@@ -228,7 +211,7 @@ nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos)
228 dentry->d_parent->d_name.name, dentry->d_name.name, 211 dentry->d_parent->d_name.name, dentry->d_name.name,
229 (unsigned long) count, (unsigned long) pos); 212 (unsigned long) count, (unsigned long) pos);
230 213
231 result = nfs_revalidate_file(inode, iocb->ki_filp); 214 result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
232 nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count); 215 nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count);
233 if (!result) 216 if (!result)
234 result = generic_file_aio_read(iocb, buf, count, pos); 217 result = generic_file_aio_read(iocb, buf, count, pos);
@@ -247,7 +230,7 @@ nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
247 dentry->d_parent->d_name.name, dentry->d_name.name, 230 dentry->d_parent->d_name.name, dentry->d_name.name,
248 (unsigned long) count, (unsigned long long) *ppos); 231 (unsigned long) count, (unsigned long long) *ppos);
249 232
250 res = nfs_revalidate_file(inode, filp); 233 res = nfs_revalidate_mapping(inode, filp->f_mapping);
251 if (!res) 234 if (!res)
252 res = generic_file_sendfile(filp, ppos, count, actor, target); 235 res = generic_file_sendfile(filp, ppos, count, actor, target);
253 return res; 236 return res;
@@ -263,7 +246,7 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
263 dfprintk(VFS, "nfs: mmap(%s/%s)\n", 246 dfprintk(VFS, "nfs: mmap(%s/%s)\n",
264 dentry->d_parent->d_name.name, dentry->d_name.name); 247 dentry->d_parent->d_name.name, dentry->d_name.name);
265 248
266 status = nfs_revalidate_file(inode, file); 249 status = nfs_revalidate_mapping(inode, file->f_mapping);
267 if (!status) 250 if (!status)
268 status = generic_file_mmap(file, vma); 251 status = generic_file_mmap(file, vma);
269 return status; 252 return status;
@@ -320,7 +303,11 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse
320 303
321static void nfs_invalidate_page(struct page *page, unsigned long offset) 304static void nfs_invalidate_page(struct page *page, unsigned long offset)
322{ 305{
323 /* FIXME: we really should cancel any unstarted writes on this page */ 306 struct inode *inode = page->mapping->host;
307
308 /* Cancel any unstarted writes on this page */
309 if (offset == 0)
310 nfs_sync_inode_wait(inode, page->index, 1, FLUSH_INVALIDATE);
324} 311}
325 312
326static int nfs_release_page(struct page *page, gfp_t gfp) 313static int nfs_release_page(struct page *page, gfp_t gfp)
@@ -373,7 +360,6 @@ nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t
373 if (result) 360 if (result)
374 goto out; 361 goto out;
375 } 362 }
376 nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
377 363
378 result = count; 364 result = count;
379 if (!count) 365 if (!count)