Browse Source

NFS: Block new writes while syncing data in nfs_getattr()

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Trond Myklebust 10 năm trước cách đây
mục cha
commit
8c18d76bcb
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      fs/nfs/inode.c

+ 2 - 0
fs/nfs/inode.c

@@ -649,7 +649,9 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 	trace_nfs_getattr_enter(inode);
 	trace_nfs_getattr_enter(inode);
 	/* Flush out writes to the server in order to update c/mtime.  */
 	/* Flush out writes to the server in order to update c/mtime.  */
 	if (S_ISREG(inode->i_mode)) {
 	if (S_ISREG(inode->i_mode)) {
+		mutex_lock(&inode->i_mutex);
 		err = nfs_sync_inode(inode);
 		err = nfs_sync_inode(inode);
+		mutex_unlock(&inode->i_mutex);
 		if (err)
 		if (err)
 			goto out;
 			goto out;
 	}
 	}