Skip to content

Commit

Permalink
Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR"
Browse files Browse the repository at this point in the history
This reverts commit df66e75.

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>
  • Loading branch information
J. Bruce Fields committed Aug 30, 2013
1 parent b8297ce commit 3477565
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3477565

Please sign in to comment.