diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 2919271a983a..5aa0dd1e1bdf 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -65,7 +65,6 @@ static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *) | |||
65 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry); | 65 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry); |
66 | static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception); | 66 | static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception); |
67 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp); | 67 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp); |
68 | static int _nfs4_do_access(struct inode *inode, struct rpc_cred *cred, int openflags); | ||
69 | static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr); | 68 | static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr); |
70 | static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr); | 69 | static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr); |
71 | 70 | ||
@@ -454,7 +453,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata) | |||
454 | memcpy(stateid.data, delegation->stateid.data, sizeof(stateid.data)); | 453 | memcpy(stateid.data, delegation->stateid.data, sizeof(stateid.data)); |
455 | rcu_read_unlock(); | 454 | rcu_read_unlock(); |
456 | lock_kernel(); | 455 | lock_kernel(); |
457 | ret = _nfs4_do_access(state->inode, state->owner->so_cred, open_mode); | 456 | ret = nfs_may_open(state->inode, state->owner->so_cred, open_mode); |
458 | unlock_kernel(); | 457 | unlock_kernel(); |
459 | if (ret != 0) | 458 | if (ret != 0) |
460 | goto out; | 459 | goto out; |
@@ -948,36 +947,6 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
948 | return 0; | 947 | return 0; |
949 | } | 948 | } |
950 | 949 | ||
951 | static int _nfs4_do_access(struct inode *inode, struct rpc_cred *cred, int openflags) | ||
952 | { | ||
953 | struct nfs_access_entry cache; | ||
954 | int mask = 0; | ||
955 | int status; | ||
956 | |||
957 | if (openflags & FMODE_READ) | ||
958 | mask |= MAY_READ; | ||
959 | if (openflags & FMODE_WRITE) | ||
960 | mask |= MAY_WRITE; | ||
961 | if (openflags & FMODE_EXEC) | ||
962 | mask |= MAY_EXEC; | ||
963 | status = nfs_access_get_cached(inode, cred, &cache); | ||
964 | if (status == 0) | ||
965 | goto out; | ||
966 | |||
967 | /* Be clever: ask server to check for all possible rights */ | ||
968 | cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ; | ||
969 | cache.cred = cred; | ||
970 | cache.jiffies = jiffies; | ||
971 | status = _nfs4_proc_access(inode, &cache); | ||
972 | if (status != 0) | ||
973 | return status; | ||
974 | nfs_access_add_cache(inode, &cache); | ||
975 | out: | ||
976 | if ((cache.mask & mask) == mask) | ||
977 | return 0; | ||
978 | return -EACCES; | ||
979 | } | ||
980 | |||
981 | static int nfs4_recover_expired_lease(struct nfs_server *server) | 950 | static int nfs4_recover_expired_lease(struct nfs_server *server) |
982 | { | 951 | { |
983 | struct nfs_client *clp = server->nfs_client; | 952 | struct nfs_client *clp = server->nfs_client; |
@@ -1381,7 +1350,7 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct | |||
1381 | 1350 | ||
1382 | /* If the open_intent is for execute, we have an extra check to make */ | 1351 | /* If the open_intent is for execute, we have an extra check to make */ |
1383 | if (nd->intent.open.flags & FMODE_EXEC) { | 1352 | if (nd->intent.open.flags & FMODE_EXEC) { |
1384 | ret = _nfs4_do_access(state->inode, | 1353 | ret = nfs_may_open(state->inode, |
1385 | state->owner->so_cred, | 1354 | state->owner->so_cred, |
1386 | nd->intent.open.flags); | 1355 | nd->intent.open.flags); |
1387 | if (ret < 0) | 1356 | if (ret < 0) |