nfs: don't take i_mutex on nfs_wb_nocommit() Set the AS_SYNC_WAITER flag and let VFS throttle application writes. CC: Peter Staubach CC: Myklebust Trond Signed-off-by: Wu Fengguang --- fs/nfs/inode.c | 9 +-------- fs/nfs/write.c | 6 +++++- 2 files changed, 6 insertions(+), 9 deletions(-) --- linux.orig/fs/nfs/inode.c 2009-10-07 10:03:26.000000000 +0800 +++ linux/fs/nfs/inode.c 2009-10-08 08:18:37.000000000 +0800 @@ -513,16 +513,9 @@ int nfs_getattr(struct vfsmount *mnt, st /* * Flush out writes to the server in order to update c/mtime. - * - * Hold the i_mutex to suspend application writes temporarily; - * this prevents long-running writing applications from blocking - * nfs_wb_nocommit. */ - if (S_ISREG(inode->i_mode)) { - mutex_lock(&inode->i_mutex); + if (S_ISREG(inode->i_mode)) nfs_wb_nocommit(inode); - mutex_unlock(&inode->i_mutex); - } /* * We may force a getattr if the user cares about atime. --- linux.orig/fs/nfs/write.c 2009-10-08 08:21:02.000000000 +0800 +++ linux/fs/nfs/write.c 2009-10-08 08:31:01.000000000 +0800 @@ -1539,8 +1539,12 @@ static int nfs_write_mapping(struct addr .range_start = 0, .range_end = LLONG_MAX, }; + int ret; - return __nfs_write_mapping(mapping, &wbc, how); + set_bit(AS_SYNC_WAITER, &mapping->flags); + ret = __nfs_write_mapping(mapping, &wbc, how); + clear_bit(AS_SYNC_WAITER, &mapping->flags); + return ret; } /*