aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index aa5a831001ab..443772df9b17 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -495,17 +495,11 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
495 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; 495 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME;
496 int err; 496 int err;
497 497
498 /* 498 /* Flush out writes to the server in order to update c/mtime. */
499 * Flush out writes to the server in order to update c/mtime.
500 *
501 * Hold the i_mutex to suspend application writes temporarily;
502 * this prevents long-running writing applications from blocking
503 * nfs_wb_nocommit.
504 */
505 if (S_ISREG(inode->i_mode)) { 499 if (S_ISREG(inode->i_mode)) {
506 mutex_lock(&inode->i_mutex); 500 err = filemap_write_and_wait(inode->i_mapping);
507 nfs_wb_nocommit(inode); 501 if (err)
508 mutex_unlock(&inode->i_mutex); 502 goto out;
509 } 503 }
510 504
511 /* 505 /*
@@ -529,6 +523,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
529 generic_fillattr(inode, stat); 523 generic_fillattr(inode, stat);
530 stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); 524 stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
531 } 525 }
526out:
532 return err; 527 return err;
533} 528}
534 529