diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:25 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:47 -0500 |
commit | b4454fe1a7cb76a248d0641c9d68a44a1b8d9a1f (patch) | |
tree | 50ddc265e9700b1924e45ffce0f4583ba1013177 /fs/nfs/nfs4proc.c | |
parent | 58d9714a44a79bba9b414da3ffbf3c753dc5915f (diff) |
NFSv4: Remove requirement for machine creds for the "renew" operation
In RFC3530, the RENEW operation is allowed to use either
the same principal, RPC security flavour and (if RPCSEC_GSS), the same
mechanism and service that was used for SETCLIENTID_CONFIRM
OR
Any principal, RPC security flavour and service combination that
currently has an OPEN file on the server.
Choose the latter since that doesn't require us to keep credentials for
the same principal for the entire duration of the mount.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cc33a1c32cfb..e38401931291 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -850,9 +850,14 @@ static int _nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred | |||
850 | int open_flags = flags & (FMODE_READ|FMODE_WRITE); | 850 | int open_flags = flags & (FMODE_READ|FMODE_WRITE); |
851 | int err; | 851 | int err; |
852 | 852 | ||
853 | err = -ENOMEM; | ||
854 | if (!(sp = nfs4_get_state_owner(server, cred))) { | ||
855 | dprintk("%s: nfs4_get_state_owner failed!\n", __FUNCTION__); | ||
856 | return err; | ||
857 | } | ||
853 | err = nfs4_recover_expired_lease(server); | 858 | err = nfs4_recover_expired_lease(server); |
854 | if (err != 0) | 859 | if (err != 0) |
855 | return err; | 860 | goto out_put_state_owner; |
856 | /* Protect against reboot recovery - NOTE ORDER! */ | 861 | /* Protect against reboot recovery - NOTE ORDER! */ |
857 | down_read(&clp->cl_sem); | 862 | down_read(&clp->cl_sem); |
858 | /* Protect against delegation recall */ | 863 | /* Protect against delegation recall */ |
@@ -862,10 +867,6 @@ static int _nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred | |||
862 | if (delegation == NULL || (delegation->type & open_flags) != open_flags) | 867 | if (delegation == NULL || (delegation->type & open_flags) != open_flags) |
863 | goto out_err; | 868 | goto out_err; |
864 | err = -ENOMEM; | 869 | err = -ENOMEM; |
865 | if (!(sp = nfs4_get_state_owner(server, cred))) { | ||
866 | dprintk("%s: nfs4_get_state_owner failed!\n", __FUNCTION__); | ||
867 | goto out_err; | ||
868 | } | ||
869 | state = nfs4_get_open_state(inode, sp); | 870 | state = nfs4_get_open_state(inode, sp); |
870 | if (state == NULL) | 871 | if (state == NULL) |
871 | goto out_err; | 872 | goto out_err; |
@@ -877,13 +878,13 @@ static int _nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred | |||
877 | spin_unlock(&inode->i_lock); | 878 | spin_unlock(&inode->i_lock); |
878 | goto out_ok; | 879 | goto out_ok; |
879 | } else if (state->state != 0) | 880 | } else if (state->state != 0) |
880 | goto out_err; | 881 | goto out_put_open_state; |
881 | 882 | ||
882 | lock_kernel(); | 883 | lock_kernel(); |
883 | err = _nfs4_do_access(inode, cred, open_flags); | 884 | err = _nfs4_do_access(inode, cred, open_flags); |
884 | unlock_kernel(); | 885 | unlock_kernel(); |
885 | if (err != 0) | 886 | if (err != 0) |
886 | goto out_err; | 887 | goto out_put_open_state; |
887 | set_bit(NFS_DELEGATED_STATE, &state->flags); | 888 | set_bit(NFS_DELEGATED_STATE, &state->flags); |
888 | update_open_stateid(state, &delegation->stateid, open_flags); | 889 | update_open_stateid(state, &delegation->stateid, open_flags); |
889 | out_ok: | 890 | out_ok: |
@@ -891,17 +892,16 @@ out_ok: | |||
891 | up_read(&nfsi->rwsem); | 892 | up_read(&nfsi->rwsem); |
892 | up_read(&clp->cl_sem); | 893 | up_read(&clp->cl_sem); |
893 | *res = state; | 894 | *res = state; |
894 | return 0; | 895 | return 0; |
896 | out_put_open_state: | ||
897 | nfs4_put_open_state(state); | ||
895 | out_err: | 898 | out_err: |
896 | if (sp != NULL) { | ||
897 | if (state != NULL) | ||
898 | nfs4_put_open_state(state); | ||
899 | nfs4_put_state_owner(sp); | ||
900 | } | ||
901 | up_read(&nfsi->rwsem); | 899 | up_read(&nfsi->rwsem); |
902 | up_read(&clp->cl_sem); | 900 | up_read(&clp->cl_sem); |
903 | if (err != -EACCES) | 901 | if (err != -EACCES) |
904 | nfs_inode_return_delegation(inode); | 902 | nfs_inode_return_delegation(inode); |
903 | out_put_state_owner: | ||
904 | nfs4_put_state_owner(sp); | ||
905 | return err; | 905 | return err; |
906 | } | 906 | } |
907 | 907 | ||
@@ -941,7 +941,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st | |||
941 | } | 941 | } |
942 | status = nfs4_recover_expired_lease(server); | 942 | status = nfs4_recover_expired_lease(server); |
943 | if (status != 0) | 943 | if (status != 0) |
944 | goto out_err; | 944 | goto err_put_state_owner; |
945 | down_read(&clp->cl_sem); | 945 | down_read(&clp->cl_sem); |
946 | status = -ENOMEM; | 946 | status = -ENOMEM; |
947 | opendata = nfs4_opendata_alloc(dentry, sp, flags, sattr); | 947 | opendata = nfs4_opendata_alloc(dentry, sp, flags, sattr); |
@@ -2518,26 +2518,24 @@ static const struct rpc_call_ops nfs4_renew_ops = { | |||
2518 | .rpc_call_done = nfs4_renew_done, | 2518 | .rpc_call_done = nfs4_renew_done, |
2519 | }; | 2519 | }; |
2520 | 2520 | ||
2521 | int | 2521 | int nfs4_proc_async_renew(struct nfs4_client *clp, struct rpc_cred *cred) |
2522 | nfs4_proc_async_renew(struct nfs4_client *clp) | ||
2523 | { | 2522 | { |
2524 | struct rpc_message msg = { | 2523 | struct rpc_message msg = { |
2525 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 2524 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
2526 | .rpc_argp = clp, | 2525 | .rpc_argp = clp, |
2527 | .rpc_cred = clp->cl_cred, | 2526 | .rpc_cred = cred, |
2528 | }; | 2527 | }; |
2529 | 2528 | ||
2530 | return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, | 2529 | return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, |
2531 | &nfs4_renew_ops, (void *)jiffies); | 2530 | &nfs4_renew_ops, (void *)jiffies); |
2532 | } | 2531 | } |
2533 | 2532 | ||
2534 | int | 2533 | int nfs4_proc_renew(struct nfs4_client *clp, struct rpc_cred *cred) |
2535 | nfs4_proc_renew(struct nfs4_client *clp) | ||
2536 | { | 2534 | { |
2537 | struct rpc_message msg = { | 2535 | struct rpc_message msg = { |
2538 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 2536 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
2539 | .rpc_argp = clp, | 2537 | .rpc_argp = clp, |
2540 | .rpc_cred = clp->cl_cred, | 2538 | .rpc_cred = cred, |
2541 | }; | 2539 | }; |
2542 | unsigned long now = jiffies; | 2540 | unsigned long now = jiffies; |
2543 | int status; | 2541 | int status; |