diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-07-11 17:54:34 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2017-07-21 11:51:19 -0400 |
commit | bd8b2441742b49c76bec707757bd9c028ea9838e (patch) | |
tree | 950978dc49c18fe92a7e17b63f3a07286c463e1a | |
parent | eda3e20847788c453aa7ab478aeaceb56ed29cb6 (diff) |
NFS: Store the raw NFS access mask in the inode's access cache
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | fs/nfs/dir.c | 9 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 24b3a6748062..8fae8b00b8f5 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -2399,7 +2399,7 @@ nfs_access_calc_mask(u32 access_result) | |||
2399 | 2399 | ||
2400 | void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result) | 2400 | void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result) |
2401 | { | 2401 | { |
2402 | entry->mask = nfs_access_calc_mask(access_result); | 2402 | entry->mask = access_result; |
2403 | } | 2403 | } |
2404 | EXPORT_SYMBOL_GPL(nfs_access_set_mask); | 2404 | EXPORT_SYMBOL_GPL(nfs_access_set_mask); |
2405 | 2405 | ||
@@ -2407,6 +2407,7 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) | |||
2407 | { | 2407 | { |
2408 | struct nfs_access_entry cache; | 2408 | struct nfs_access_entry cache; |
2409 | bool may_block = (mask & MAY_NOT_BLOCK) == 0; | 2409 | bool may_block = (mask & MAY_NOT_BLOCK) == 0; |
2410 | int cache_mask; | ||
2410 | int status; | 2411 | int status; |
2411 | 2412 | ||
2412 | trace_nfs_access_enter(inode); | 2413 | trace_nfs_access_enter(inode); |
@@ -2422,7 +2423,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask) | |||
2422 | goto out; | 2423 | goto out; |
2423 | 2424 | ||
2424 | /* Be clever: ask server to check for all possible rights */ | 2425 | /* Be clever: ask server to check for all possible rights */ |
2425 | cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ; | 2426 | cache.mask = NFS_MAY_LOOKUP | NFS_MAY_EXECUTE |
2427 | | NFS_MAY_WRITE | NFS_MAY_READ; | ||
2426 | cache.cred = cred; | 2428 | cache.cred = cred; |
2427 | cache.jiffies = jiffies; | 2429 | cache.jiffies = jiffies; |
2428 | status = NFS_PROTO(inode)->access(inode, &cache); | 2430 | 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 | } | 2438 | } |
2437 | nfs_access_add_cache(inode, &cache); | 2439 | nfs_access_add_cache(inode, &cache); |
2438 | out_cached: | 2440 | out_cached: |
2439 | if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0) | 2441 | cache_mask = nfs_access_calc_mask(cache.mask); |
2442 | if ((mask & ~cache_mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0) | ||
2440 | status = -EACCES; | 2443 | status = -EACCES; |
2441 | out: | 2444 | out: |
2442 | trace_nfs_access_exit(inode, status); | 2445 | trace_nfs_access_exit(inode, status); |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index e52cc55ac300..5cc91d6381a3 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -51,7 +51,7 @@ struct nfs_access_entry { | |||
51 | struct list_head lru; | 51 | struct list_head lru; |
52 | unsigned long jiffies; | 52 | unsigned long jiffies; |
53 | struct rpc_cred * cred; | 53 | struct rpc_cred * cred; |
54 | int mask; | 54 | __u32 mask; |
55 | struct rcu_head rcu_head; | 55 | struct rcu_head rcu_head; |
56 | }; | 56 | }; |
57 | 57 | ||