diff options
-rw-r--r-- | fs/nfs/nfs4proc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e1a26c653e78..583c2b38c908 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2236,7 +2236,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
2236 | int openflags) | 2236 | int openflags) |
2237 | { | 2237 | { |
2238 | struct nfs_access_entry cache; | 2238 | struct nfs_access_entry cache; |
2239 | u32 mask; | 2239 | u32 mask, flags; |
2240 | 2240 | ||
2241 | /* access call failed or for some reason the server doesn't | 2241 | /* access call failed or for some reason the server doesn't |
2242 | * support any access modes -- defer access call until later */ | 2242 | * support any access modes -- defer access call until later */ |
@@ -2250,16 +2250,20 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
2250 | */ | 2250 | */ |
2251 | if (openflags & __FMODE_EXEC) { | 2251 | if (openflags & __FMODE_EXEC) { |
2252 | /* ONLY check for exec rights */ | 2252 | /* ONLY check for exec rights */ |
2253 | mask = MAY_EXEC; | 2253 | if (S_ISDIR(state->inode->i_mode)) |
2254 | mask = NFS4_ACCESS_LOOKUP; | ||
2255 | else | ||
2256 | mask = NFS4_ACCESS_EXECUTE; | ||
2254 | } else if ((fmode & FMODE_READ) && !opendata->file_created) | 2257 | } else if ((fmode & FMODE_READ) && !opendata->file_created) |
2255 | mask = MAY_READ; | 2258 | mask = NFS4_ACCESS_READ; |
2256 | 2259 | ||
2257 | cache.cred = cred; | 2260 | cache.cred = cred; |
2258 | cache.jiffies = jiffies; | 2261 | cache.jiffies = jiffies; |
2259 | nfs_access_set_mask(&cache, opendata->o_res.access_result); | 2262 | nfs_access_set_mask(&cache, opendata->o_res.access_result); |
2260 | nfs_access_add_cache(state->inode, &cache); | 2263 | nfs_access_add_cache(state->inode, &cache); |
2261 | 2264 | ||
2262 | if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0) | 2265 | flags = NFS4_ACCESS_READ | NFS4_ACCESS_EXECUTE | NFS4_ACCESS_LOOKUP; |
2266 | if ((mask & ~cache.mask & flags) == 0) | ||
2263 | return 0; | 2267 | return 0; |
2264 | 2268 | ||
2265 | return -EACCES; | 2269 | return -EACCES; |