diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2006-06-30 04:56:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-30 14:25:40 -0400 |
commit | ba5a6a19d83babe00be3711db3deee5c57587b8f (patch) | |
tree | ccc35a1a51b6952b58b0afa27ff556b2a617881f /fs/nfsd | |
parent | 1df0cada03644e37ae6fefd7c0267d9a531991e2 (diff) |
[PATCH] knfsd: nfsd4: fix some open argument tests
These tests always returned true; clearly that wasn't what was intended.
In keeping with kernel style, make them functions instead of macros while
we're at it.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4810577347cf..591dc6ba6e19 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1237,8 +1237,15 @@ find_file(struct inode *ino) | |||
1237 | return NULL; | 1237 | return NULL; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | #define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0) | 1240 | static int access_valid(u32 x) |
1241 | #define TEST_DENY(x) ((x >= 0 || x < 5)?1:0) | 1241 | { |
1242 | return (x > 0 && x < 4); | ||
1243 | } | ||
1244 | |||
1245 | static int deny_valid(u32 x) | ||
1246 | { | ||
1247 | return (x >= 0 && x < 5); | ||
1248 | } | ||
1242 | 1249 | ||
1243 | static void | 1250 | static void |
1244 | set_access(unsigned int *access, unsigned long bmap) { | 1251 | set_access(unsigned int *access, unsigned long bmap) { |
@@ -1745,7 +1752,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
1745 | int status; | 1752 | int status; |
1746 | 1753 | ||
1747 | status = nfserr_inval; | 1754 | status = nfserr_inval; |
1748 | if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny)) | 1755 | if (!access_valid(open->op_share_access) |
1756 | || !deny_valid(open->op_share_deny)) | ||
1749 | goto out; | 1757 | goto out; |
1750 | /* | 1758 | /* |
1751 | * Lookup file; if found, lookup stateid and check open request, | 1759 | * Lookup file; if found, lookup stateid and check open request, |
@@ -2317,7 +2325,8 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n | |||
2317 | (int)current_fh->fh_dentry->d_name.len, | 2325 | (int)current_fh->fh_dentry->d_name.len, |
2318 | current_fh->fh_dentry->d_name.name); | 2326 | current_fh->fh_dentry->d_name.name); |
2319 | 2327 | ||
2320 | if (!TEST_ACCESS(od->od_share_access) || !TEST_DENY(od->od_share_deny)) | 2328 | if (!access_valid(od->od_share_access) |
2329 | || !deny_valid(od->od_share_deny)) | ||
2321 | return nfserr_inval; | 2330 | return nfserr_inval; |
2322 | 2331 | ||
2323 | nfs4_lock_state(); | 2332 | nfs4_lock_state(); |