diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2010-03-05 16:42:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:25 -0500 |
commit | 42e49608683ab25fbbbf9c40edb944601e543882 (patch) | |
tree | 5cc8beee91f235cdaf6be986f90275e04137c2bc /fs/nfsd/nfs4state.c | |
parent | 85f1fb72fa76eabc4481dc79f42d2b011df54762 (diff) |
vfs: take f_lock on modifying f_mode after open time
We'll introduce FMODE_RANDOM which will be runtime modified. So protect
all runtime modification to f_mode with f_lock to avoid races.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: <stable@kernel.org> [2.6.33.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f19ed866c95f..fcafe6087f69 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1998,7 +1998,9 @@ nfs4_file_downgrade(struct file *filp, unsigned int share_access) | |||
1998 | { | 1998 | { |
1999 | if (share_access & NFS4_SHARE_ACCESS_WRITE) { | 1999 | if (share_access & NFS4_SHARE_ACCESS_WRITE) { |
2000 | drop_file_write_access(filp); | 2000 | drop_file_write_access(filp); |
2001 | spin_lock(&filp->f_lock); | ||
2001 | filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE; | 2002 | filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE; |
2003 | spin_unlock(&filp->f_lock); | ||
2002 | } | 2004 | } |
2003 | } | 2005 | } |
2004 | 2006 | ||