summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-08-23 17:55:18 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-08-30 17:30:45 -0400
commit3477565e6a73da7bb50fce6ac718b31eddb37fbb (patch)
treea11a9b5d1fae7f6ca5e527d12f66aa7d1826a0a2 /fs/nfsd/nfs4state.c
parentb8297cec2da30d3a5869597dbd7c8280d46a7dba (diff)
downloadlinux-3477565e6a73da7bb50fce6ac718b31eddb37fbb.tar.gz
linux-3477565e6a73da7bb50fce6ac718b31eddb37fbb.tar.bz2
linux-3477565e6a73da7bb50fce6ac718b31eddb37fbb.zip
Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR"
This reverts commit df66e75395c839c3a373bae897dbb1248f741b45. nfsd4_lock can get a read-only or write-only reference when only a read-write open is available. This is normal. Cc: Harshula Jayasuriya <harshula@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5e609b17ada4..eb9cf818002a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -282,14 +282,19 @@ static unsigned int file_hashval(struct inode *ino)
static struct hlist_head file_hashtbl[FILE_HASH_SIZE];
+static void __nfs4_file_get_access(struct nfs4_file *fp, int oflag)
+{
+ WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR]));
+ atomic_inc(&fp->fi_access[oflag]);
+}
+
static void nfs4_file_get_access(struct nfs4_file *fp, int oflag)
{
- WARN_ON_ONCE(!fp->fi_fds[oflag]);
if (oflag == O_RDWR) {
- atomic_inc(&fp->fi_access[O_RDONLY]);
- atomic_inc(&fp->fi_access[O_WRONLY]);
+ __nfs4_file_get_access(fp, O_RDONLY);
+ __nfs4_file_get_access(fp, O_WRONLY);
} else
- atomic_inc(&fp->fi_access[oflag]);
+ __nfs4_file_get_access(fp, oflag);
}
static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag)