diff options
author | Harshula Jayasuriya <harshula@redhat.com> | 2013-07-23 00:05:14 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-07-23 12:26:51 -0400 |
commit | df66e75395c839c3a373bae897dbb1248f741b45 (patch) | |
tree | ba8ef2c7cae86d62998ea03157950de1829a83ab /fs/nfsd | |
parent | e4daf1ffbe6cc3b12aab4d604e627829e93e9914 (diff) |
nfsd: nfs4_file_get_access: need to be more careful with O_RDWR
If fi_fds = {non-NULL, NULL, non-NULL} and oflag = O_WRONLY
the WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR]))
doesn't trigger when it should.
Signed-off-by: Harshula Jayasuriya <harshula@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 280acef6f0dc..1cb621131b00 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -282,19 +282,14 @@ static unsigned int file_hashval(struct inode *ino) | |||
282 | 282 | ||
283 | static struct hlist_head file_hashtbl[FILE_HASH_SIZE]; | 283 | static struct hlist_head file_hashtbl[FILE_HASH_SIZE]; |
284 | 284 | ||
285 | static void __nfs4_file_get_access(struct nfs4_file *fp, int oflag) | ||
286 | { | ||
287 | WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR])); | ||
288 | atomic_inc(&fp->fi_access[oflag]); | ||
289 | } | ||
290 | |||
291 | static void nfs4_file_get_access(struct nfs4_file *fp, int oflag) | 285 | static void nfs4_file_get_access(struct nfs4_file *fp, int oflag) |
292 | { | 286 | { |
287 | WARN_ON_ONCE(!fp->fi_fds[oflag]); | ||
293 | if (oflag == O_RDWR) { | 288 | if (oflag == O_RDWR) { |
294 | __nfs4_file_get_access(fp, O_RDONLY); | 289 | atomic_inc(&fp->fi_access[O_RDONLY]); |
295 | __nfs4_file_get_access(fp, O_WRONLY); | 290 | atomic_inc(&fp->fi_access[O_WRONLY]); |
296 | } else | 291 | } else |
297 | __nfs4_file_get_access(fp, oflag); | 292 | atomic_inc(&fp->fi_access[oflag]); |
298 | } | 293 | } |
299 | 294 | ||
300 | static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) | 295 | static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) |