From 3a633b2c9abefca3b7549ffe42c536b02859c278 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Fri, 26 Oct 2007 13:32:13 -0400 Subject: [PATCH] --- yaml --- r: 79609 b: refs/heads/master c: 28c494c5c8d425e15b7b82571e4df6d6bc34594d h: refs/heads/master i: 79607: f6385b8504121e20c0e211ee067e076c158ae60c v: v3 --- [refs] | 2 +- trunk/fs/nfs/inode.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 3db981620771..e7ae9ac33c8b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 464ad6b1ade186b53a1dae863361853326b85694 +refs/heads/master: 28c494c5c8d425e15b7b82571e4df6d6bc34594d diff --git a/trunk/fs/nfs/inode.c b/trunk/fs/nfs/inode.c index cd0e57f3a00f..cc3a09db41a9 100644 --- a/trunk/fs/nfs/inode.c +++ b/trunk/fs/nfs/inode.c @@ -461,9 +461,18 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; int err; - /* Flush out writes to the server in order to update c/mtime */ - if (S_ISREG(inode->i_mode)) + /* + * 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); nfs_wb_nocommit(inode); + mutex_unlock(&inode->i_mutex); + } /* * We may force a getattr if the user cares about atime.