Commit bd8b2441 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFS: Store the raw NFS access mask in the inode's access cache

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent eda3e208
...@@ -2399,7 +2399,7 @@ nfs_access_calc_mask(u32 access_result) ...@@ -2399,7 +2399,7 @@ nfs_access_calc_mask(u32 access_result)
void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result) void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result)
{ {
entry->mask = nfs_access_calc_mask(access_result); entry->mask = access_result;
} }
EXPORT_SYMBOL_GPL(nfs_access_set_mask); EXPORT_SYMBOL_GPL(nfs_access_set_mask);
...@@ -2407,6 +2407,7 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) ...@@ -2407,6 +2407,7 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
{ {
struct nfs_access_entry cache; struct nfs_access_entry cache;
bool may_block = (mask & MAY_NOT_BLOCK) == 0; bool may_block = (mask & MAY_NOT_BLOCK) == 0;
int cache_mask;
int status; int status;
trace_nfs_access_enter(inode); trace_nfs_access_enter(inode);
...@@ -2422,7 +2423,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) ...@@ -2422,7 +2423,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
goto out; goto out;
/* Be clever: ask server to check for all possible rights */ /* Be clever: ask server to check for all possible rights */
cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ; cache.mask = NFS_MAY_LOOKUP | NFS_MAY_EXECUTE
| NFS_MAY_WRITE | NFS_MAY_READ;
cache.cred = cred; cache.cred = cred;
cache.jiffies = jiffies; cache.jiffies = jiffies;
status = NFS_PROTO(inode)->access(inode, &cache); status = NFS_PROTO(inode)->access(inode, &cache);
...@@ -2436,7 +2438,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) ...@@ -2436,7 +2438,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
} }
nfs_access_add_cache(inode, &cache); nfs_access_add_cache(inode, &cache);
out_cached: out_cached:
if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0) cache_mask = nfs_access_calc_mask(cache.mask);
if ((mask & ~cache_mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0)
status = -EACCES; status = -EACCES;
out: out:
trace_nfs_access_exit(inode, status); trace_nfs_access_exit(inode, status);
......
...@@ -51,7 +51,7 @@ struct nfs_access_entry { ...@@ -51,7 +51,7 @@ struct nfs_access_entry {
struct list_head lru; struct list_head lru;
unsigned long jiffies; unsigned long jiffies;
struct rpc_cred * cred; struct rpc_cred * cred;
int mask; __u32 mask;
struct rcu_head rcu_head; struct rcu_head rcu_head;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment