diff options
author | NeilBrown <neilb@suse.com> | 2018-12-02 19:30:31 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2018-12-19 13:52:46 -0500 |
commit | a52458b48af142bcc2b72fe810c0db20cfae7fdd (patch) | |
tree | cb77d59d5fdf3d50e69500b8cc7cba1c7199272f /fs/nfs/nfs4state.c | |
parent | 684f39b4cf5186bb0660e686f94296688b24fb32 (diff) |
NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'.
SUNRPC has two sorts of credentials, both of which appear as
"struct rpc_cred".
There are "generic credentials" which are supplied by clients
such as NFS and passed in 'struct rpc_message' to indicate
which user should be used to authorize the request, and there
are low-level credentials such as AUTH_NULL, AUTH_UNIX, AUTH_GSS
which describe the credential to be sent over the wires.
This patch replaces all the generic credentials by 'struct cred'
pointers - the credential structure used throughout Linux.
For machine credentials, there is a special 'struct cred *' pointer
which is statically allocated and recognized where needed as
having a special meaning. A look-up of a low-level cred will
map this to a machine credential.
Signed-off-by: NeilBrown <neilb@suse.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 6304c79dbcd1..9555a8a9200a 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -87,7 +87,7 @@ const nfs4_stateid current_stateid = { | |||
87 | 87 | ||
88 | static DEFINE_MUTEX(nfs_clid_init_mutex); | 88 | static DEFINE_MUTEX(nfs_clid_init_mutex); |
89 | 89 | ||
90 | int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | 90 | int nfs4_init_clientid(struct nfs_client *clp, const struct cred *cred) |
91 | { | 91 | { |
92 | struct nfs4_setclientid_res clid = { | 92 | struct nfs4_setclientid_res clid = { |
93 | .clientid = clp->cl_clientid, | 93 | .clientid = clp->cl_clientid, |
@@ -134,7 +134,7 @@ out: | |||
134 | */ | 134 | */ |
135 | int nfs40_discover_server_trunking(struct nfs_client *clp, | 135 | int nfs40_discover_server_trunking(struct nfs_client *clp, |
136 | struct nfs_client **result, | 136 | struct nfs_client **result, |
137 | struct rpc_cred *cred) | 137 | const struct cred *cred) |
138 | { | 138 | { |
139 | struct nfs4_setclientid_res clid = { | 139 | struct nfs4_setclientid_res clid = { |
140 | .clientid = clp->cl_clientid, | 140 | .clientid = clp->cl_clientid, |
@@ -164,9 +164,9 @@ out: | |||
164 | return status; | 164 | return status; |
165 | } | 165 | } |
166 | 166 | ||
167 | struct rpc_cred *nfs4_get_machine_cred(struct nfs_client *clp) | 167 | const struct cred *nfs4_get_machine_cred(struct nfs_client *clp) |
168 | { | 168 | { |
169 | return get_rpccred(rpc_machine_cred()); | 169 | return get_cred(rpc_machine_cred()); |
170 | } | 170 | } |
171 | 171 | ||
172 | static void nfs4_root_machine_cred(struct nfs_client *clp) | 172 | static void nfs4_root_machine_cred(struct nfs_client *clp) |
@@ -177,10 +177,10 @@ static void nfs4_root_machine_cred(struct nfs_client *clp) | |||
177 | clp->cl_rpcclient->cl_principal = NULL; | 177 | clp->cl_rpcclient->cl_principal = NULL; |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct rpc_cred * | 180 | static const struct cred * |
181 | nfs4_get_renew_cred_server_locked(struct nfs_server *server) | 181 | nfs4_get_renew_cred_server_locked(struct nfs_server *server) |
182 | { | 182 | { |
183 | struct rpc_cred *cred = NULL; | 183 | const struct cred *cred = NULL; |
184 | struct nfs4_state_owner *sp; | 184 | struct nfs4_state_owner *sp; |
185 | struct rb_node *pos; | 185 | struct rb_node *pos; |
186 | 186 | ||
@@ -190,7 +190,7 @@ nfs4_get_renew_cred_server_locked(struct nfs_server *server) | |||
190 | sp = rb_entry(pos, struct nfs4_state_owner, so_server_node); | 190 | sp = rb_entry(pos, struct nfs4_state_owner, so_server_node); |
191 | if (list_empty(&sp->so_states)) | 191 | if (list_empty(&sp->so_states)) |
192 | continue; | 192 | continue; |
193 | cred = get_rpccred(sp->so_cred); | 193 | cred = get_cred(sp->so_cred); |
194 | break; | 194 | break; |
195 | } | 195 | } |
196 | return cred; | 196 | return cred; |
@@ -203,9 +203,9 @@ nfs4_get_renew_cred_server_locked(struct nfs_server *server) | |||
203 | * Returns an rpc_cred with reference count bumped, or NULL. | 203 | * Returns an rpc_cred with reference count bumped, or NULL. |
204 | * Caller must hold clp->cl_lock. | 204 | * Caller must hold clp->cl_lock. |
205 | */ | 205 | */ |
206 | struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) | 206 | const struct cred *nfs4_get_renew_cred(struct nfs_client *clp) |
207 | { | 207 | { |
208 | struct rpc_cred *cred = NULL; | 208 | const struct cred *cred = NULL; |
209 | struct nfs_server *server; | 209 | struct nfs_server *server; |
210 | 210 | ||
211 | /* Use machine credentials if available */ | 211 | /* Use machine credentials if available */ |
@@ -312,7 +312,7 @@ static void nfs41_finish_session_reset(struct nfs_client *clp) | |||
312 | nfs41_setup_state_renewal(clp); | 312 | nfs41_setup_state_renewal(clp); |
313 | } | 313 | } |
314 | 314 | ||
315 | int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | 315 | int nfs41_init_clientid(struct nfs_client *clp, const struct cred *cred) |
316 | { | 316 | { |
317 | int status; | 317 | int status; |
318 | 318 | ||
@@ -347,7 +347,7 @@ out: | |||
347 | */ | 347 | */ |
348 | int nfs41_discover_server_trunking(struct nfs_client *clp, | 348 | int nfs41_discover_server_trunking(struct nfs_client *clp, |
349 | struct nfs_client **result, | 349 | struct nfs_client **result, |
350 | struct rpc_cred *cred) | 350 | const struct cred *cred) |
351 | { | 351 | { |
352 | int status; | 352 | int status; |
353 | 353 | ||
@@ -385,30 +385,32 @@ int nfs41_discover_server_trunking(struct nfs_client *clp, | |||
385 | * nfs4_get_clid_cred - Acquire credential for a setclientid operation | 385 | * nfs4_get_clid_cred - Acquire credential for a setclientid operation |
386 | * @clp: client state handle | 386 | * @clp: client state handle |
387 | * | 387 | * |
388 | * Returns an rpc_cred with reference count bumped, or NULL. | 388 | * Returns a cred with reference count bumped, or NULL. |
389 | */ | 389 | */ |
390 | struct rpc_cred *nfs4_get_clid_cred(struct nfs_client *clp) | 390 | const struct cred *nfs4_get_clid_cred(struct nfs_client *clp) |
391 | { | 391 | { |
392 | struct rpc_cred *cred; | 392 | const struct cred *cred; |
393 | 393 | ||
394 | cred = nfs4_get_machine_cred(clp); | 394 | cred = nfs4_get_machine_cred(clp); |
395 | return cred; | 395 | return cred; |
396 | } | 396 | } |
397 | 397 | ||
398 | static struct nfs4_state_owner * | 398 | static struct nfs4_state_owner * |
399 | nfs4_find_state_owner_locked(struct nfs_server *server, struct rpc_cred *cred) | 399 | nfs4_find_state_owner_locked(struct nfs_server *server, const struct cred *cred) |
400 | { | 400 | { |
401 | struct rb_node **p = &server->state_owners.rb_node, | 401 | struct rb_node **p = &server->state_owners.rb_node, |
402 | *parent = NULL; | 402 | *parent = NULL; |
403 | struct nfs4_state_owner *sp; | 403 | struct nfs4_state_owner *sp; |
404 | int cmp; | ||
404 | 405 | ||
405 | while (*p != NULL) { | 406 | while (*p != NULL) { |
406 | parent = *p; | 407 | parent = *p; |
407 | sp = rb_entry(parent, struct nfs4_state_owner, so_server_node); | 408 | sp = rb_entry(parent, struct nfs4_state_owner, so_server_node); |
409 | cmp = cred_fscmp(cred, sp->so_cred); | ||
408 | 410 | ||
409 | if (cred < sp->so_cred) | 411 | if (cmp < 0) |
410 | p = &parent->rb_left; | 412 | p = &parent->rb_left; |
411 | else if (cred > sp->so_cred) | 413 | else if (cmp > 0) |
412 | p = &parent->rb_right; | 414 | p = &parent->rb_right; |
413 | else { | 415 | else { |
414 | if (!list_empty(&sp->so_lru)) | 416 | if (!list_empty(&sp->so_lru)) |
@@ -427,14 +429,16 @@ nfs4_insert_state_owner_locked(struct nfs4_state_owner *new) | |||
427 | struct rb_node **p = &server->state_owners.rb_node, | 429 | struct rb_node **p = &server->state_owners.rb_node, |
428 | *parent = NULL; | 430 | *parent = NULL; |
429 | struct nfs4_state_owner *sp; | 431 | struct nfs4_state_owner *sp; |
432 | int cmp; | ||
430 | 433 | ||
431 | while (*p != NULL) { | 434 | while (*p != NULL) { |
432 | parent = *p; | 435 | parent = *p; |
433 | sp = rb_entry(parent, struct nfs4_state_owner, so_server_node); | 436 | sp = rb_entry(parent, struct nfs4_state_owner, so_server_node); |
437 | cmp = cred_fscmp(new->so_cred, sp->so_cred); | ||
434 | 438 | ||
435 | if (new->so_cred < sp->so_cred) | 439 | if (cmp < 0) |
436 | p = &parent->rb_left; | 440 | p = &parent->rb_left; |
437 | else if (new->so_cred > sp->so_cred) | 441 | else if (cmp > 0) |
438 | p = &parent->rb_right; | 442 | p = &parent->rb_right; |
439 | else { | 443 | else { |
440 | if (!list_empty(&sp->so_lru)) | 444 | if (!list_empty(&sp->so_lru)) |
@@ -481,7 +485,7 @@ nfs4_destroy_seqid_counter(struct nfs_seqid_counter *sc) | |||
481 | */ | 485 | */ |
482 | static struct nfs4_state_owner * | 486 | static struct nfs4_state_owner * |
483 | nfs4_alloc_state_owner(struct nfs_server *server, | 487 | nfs4_alloc_state_owner(struct nfs_server *server, |
484 | struct rpc_cred *cred, | 488 | const struct cred *cred, |
485 | gfp_t gfp_flags) | 489 | gfp_t gfp_flags) |
486 | { | 490 | { |
487 | struct nfs4_state_owner *sp; | 491 | struct nfs4_state_owner *sp; |
@@ -496,7 +500,7 @@ nfs4_alloc_state_owner(struct nfs_server *server, | |||
496 | return NULL; | 500 | return NULL; |
497 | } | 501 | } |
498 | sp->so_server = server; | 502 | sp->so_server = server; |
499 | sp->so_cred = get_rpccred(cred); | 503 | sp->so_cred = get_cred(cred); |
500 | spin_lock_init(&sp->so_lock); | 504 | spin_lock_init(&sp->so_lock); |
501 | INIT_LIST_HEAD(&sp->so_states); | 505 | INIT_LIST_HEAD(&sp->so_states); |
502 | nfs4_init_seqid_counter(&sp->so_seqid); | 506 | nfs4_init_seqid_counter(&sp->so_seqid); |
@@ -525,7 +529,7 @@ nfs4_reset_state_owner(struct nfs4_state_owner *sp) | |||
525 | static void nfs4_free_state_owner(struct nfs4_state_owner *sp) | 529 | static void nfs4_free_state_owner(struct nfs4_state_owner *sp) |
526 | { | 530 | { |
527 | nfs4_destroy_seqid_counter(&sp->so_seqid); | 531 | nfs4_destroy_seqid_counter(&sp->so_seqid); |
528 | put_rpccred(sp->so_cred); | 532 | put_cred(sp->so_cred); |
529 | ida_simple_remove(&sp->so_server->openowner_id, sp->so_seqid.owner_id); | 533 | ida_simple_remove(&sp->so_server->openowner_id, sp->so_seqid.owner_id); |
530 | kfree(sp); | 534 | kfree(sp); |
531 | } | 535 | } |
@@ -563,7 +567,7 @@ static void nfs4_gc_state_owners(struct nfs_server *server) | |||
563 | * Returns a pointer to an instantiated nfs4_state_owner struct, or NULL. | 567 | * Returns a pointer to an instantiated nfs4_state_owner struct, or NULL. |
564 | */ | 568 | */ |
565 | struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, | 569 | struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, |
566 | struct rpc_cred *cred, | 570 | const struct cred *cred, |
567 | gfp_t gfp_flags) | 571 | gfp_t gfp_flags) |
568 | { | 572 | { |
569 | struct nfs_client *clp = server->nfs_client; | 573 | struct nfs_client *clp = server->nfs_client; |
@@ -1032,7 +1036,7 @@ bool nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | |||
1032 | */ | 1036 | */ |
1033 | int nfs4_select_rw_stateid(struct nfs4_state *state, | 1037 | int nfs4_select_rw_stateid(struct nfs4_state *state, |
1034 | fmode_t fmode, const struct nfs_lock_context *l_ctx, | 1038 | fmode_t fmode, const struct nfs_lock_context *l_ctx, |
1035 | nfs4_stateid *dst, struct rpc_cred **cred) | 1039 | nfs4_stateid *dst, const struct cred **cred) |
1036 | { | 1040 | { |
1037 | int ret; | 1041 | int ret; |
1038 | 1042 | ||
@@ -1732,7 +1736,7 @@ static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp) | |||
1732 | 1736 | ||
1733 | static int nfs4_reclaim_complete(struct nfs_client *clp, | 1737 | static int nfs4_reclaim_complete(struct nfs_client *clp, |
1734 | const struct nfs4_state_recovery_ops *ops, | 1738 | const struct nfs4_state_recovery_ops *ops, |
1735 | struct rpc_cred *cred) | 1739 | const struct cred *cred) |
1736 | { | 1740 | { |
1737 | /* Notify the server we're done reclaiming our state */ | 1741 | /* Notify the server we're done reclaiming our state */ |
1738 | if (ops->reclaim_complete) | 1742 | if (ops->reclaim_complete) |
@@ -1783,7 +1787,7 @@ static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) | |||
1783 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | 1787 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) |
1784 | { | 1788 | { |
1785 | const struct nfs4_state_recovery_ops *ops; | 1789 | const struct nfs4_state_recovery_ops *ops; |
1786 | struct rpc_cred *cred; | 1790 | const struct cred *cred; |
1787 | int err; | 1791 | int err; |
1788 | 1792 | ||
1789 | if (!nfs4_state_clear_reclaim_reboot(clp)) | 1793 | if (!nfs4_state_clear_reclaim_reboot(clp)) |
@@ -1791,7 +1795,7 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | |||
1791 | ops = clp->cl_mvops->reboot_recovery_ops; | 1795 | ops = clp->cl_mvops->reboot_recovery_ops; |
1792 | cred = nfs4_get_clid_cred(clp); | 1796 | cred = nfs4_get_clid_cred(clp); |
1793 | err = nfs4_reclaim_complete(clp, ops, cred); | 1797 | err = nfs4_reclaim_complete(clp, ops, cred); |
1794 | put_rpccred(cred); | 1798 | put_cred(cred); |
1795 | if (err == -NFS4ERR_CONN_NOT_BOUND_TO_SESSION) | 1799 | if (err == -NFS4ERR_CONN_NOT_BOUND_TO_SESSION) |
1796 | set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); | 1800 | set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); |
1797 | } | 1801 | } |
@@ -1887,7 +1891,7 @@ restart: | |||
1887 | 1891 | ||
1888 | static int nfs4_check_lease(struct nfs_client *clp) | 1892 | static int nfs4_check_lease(struct nfs_client *clp) |
1889 | { | 1893 | { |
1890 | struct rpc_cred *cred; | 1894 | const struct cred *cred; |
1891 | const struct nfs4_state_maintenance_ops *ops = | 1895 | const struct nfs4_state_maintenance_ops *ops = |
1892 | clp->cl_mvops->state_renewal_ops; | 1896 | clp->cl_mvops->state_renewal_ops; |
1893 | int status; | 1897 | int status; |
@@ -1903,7 +1907,7 @@ static int nfs4_check_lease(struct nfs_client *clp) | |||
1903 | goto out; | 1907 | goto out; |
1904 | } | 1908 | } |
1905 | status = ops->renew_lease(clp, cred); | 1909 | status = ops->renew_lease(clp, cred); |
1906 | put_rpccred(cred); | 1910 | put_cred(cred); |
1907 | if (status == -ETIMEDOUT) { | 1911 | if (status == -ETIMEDOUT) { |
1908 | set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); | 1912 | set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state); |
1909 | return 0; | 1913 | return 0; |
@@ -1963,7 +1967,7 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) | |||
1963 | 1967 | ||
1964 | static int nfs4_establish_lease(struct nfs_client *clp) | 1968 | static int nfs4_establish_lease(struct nfs_client *clp) |
1965 | { | 1969 | { |
1966 | struct rpc_cred *cred; | 1970 | const struct cred *cred; |
1967 | const struct nfs4_state_recovery_ops *ops = | 1971 | const struct nfs4_state_recovery_ops *ops = |
1968 | clp->cl_mvops->reboot_recovery_ops; | 1972 | clp->cl_mvops->reboot_recovery_ops; |
1969 | int status; | 1973 | int status; |
@@ -1975,7 +1979,7 @@ static int nfs4_establish_lease(struct nfs_client *clp) | |||
1975 | if (cred == NULL) | 1979 | if (cred == NULL) |
1976 | return -ENOENT; | 1980 | return -ENOENT; |
1977 | status = ops->establish_clid(clp, cred); | 1981 | status = ops->establish_clid(clp, cred); |
1978 | put_rpccred(cred); | 1982 | put_cred(cred); |
1979 | if (status != 0) | 1983 | if (status != 0) |
1980 | return status; | 1984 | return status; |
1981 | pnfs_destroy_all_layouts(clp); | 1985 | pnfs_destroy_all_layouts(clp); |
@@ -2022,7 +2026,7 @@ static int nfs4_purge_lease(struct nfs_client *clp) | |||
2022 | * | 2026 | * |
2023 | * Returns zero or a negative NFS4ERR status code. | 2027 | * Returns zero or a negative NFS4ERR status code. |
2024 | */ | 2028 | */ |
2025 | static int nfs4_try_migration(struct nfs_server *server, struct rpc_cred *cred) | 2029 | static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred) |
2026 | { | 2030 | { |
2027 | struct nfs_client *clp = server->nfs_client; | 2031 | struct nfs_client *clp = server->nfs_client; |
2028 | struct nfs4_fs_locations *locations = NULL; | 2032 | struct nfs4_fs_locations *locations = NULL; |
@@ -2092,7 +2096,7 @@ static int nfs4_handle_migration(struct nfs_client *clp) | |||
2092 | const struct nfs4_state_maintenance_ops *ops = | 2096 | const struct nfs4_state_maintenance_ops *ops = |
2093 | clp->cl_mvops->state_renewal_ops; | 2097 | clp->cl_mvops->state_renewal_ops; |
2094 | struct nfs_server *server; | 2098 | struct nfs_server *server; |
2095 | struct rpc_cred *cred; | 2099 | const struct cred *cred; |
2096 | 2100 | ||
2097 | dprintk("%s: migration reported on \"%s\"\n", __func__, | 2101 | dprintk("%s: migration reported on \"%s\"\n", __func__, |
2098 | clp->cl_hostname); | 2102 | clp->cl_hostname); |
@@ -2118,13 +2122,13 @@ restart: | |||
2118 | rcu_read_unlock(); | 2122 | rcu_read_unlock(); |
2119 | status = nfs4_try_migration(server, cred); | 2123 | status = nfs4_try_migration(server, cred); |
2120 | if (status < 0) { | 2124 | if (status < 0) { |
2121 | put_rpccred(cred); | 2125 | put_cred(cred); |
2122 | return status; | 2126 | return status; |
2123 | } | 2127 | } |
2124 | goto restart; | 2128 | goto restart; |
2125 | } | 2129 | } |
2126 | rcu_read_unlock(); | 2130 | rcu_read_unlock(); |
2127 | put_rpccred(cred); | 2131 | put_cred(cred); |
2128 | return 0; | 2132 | return 0; |
2129 | } | 2133 | } |
2130 | 2134 | ||
@@ -2138,7 +2142,7 @@ static int nfs4_handle_lease_moved(struct nfs_client *clp) | |||
2138 | const struct nfs4_state_maintenance_ops *ops = | 2142 | const struct nfs4_state_maintenance_ops *ops = |
2139 | clp->cl_mvops->state_renewal_ops; | 2143 | clp->cl_mvops->state_renewal_ops; |
2140 | struct nfs_server *server; | 2144 | struct nfs_server *server; |
2141 | struct rpc_cred *cred; | 2145 | const struct cred *cred; |
2142 | 2146 | ||
2143 | dprintk("%s: lease moved reported on \"%s\"\n", __func__, | 2147 | dprintk("%s: lease moved reported on \"%s\"\n", __func__, |
2144 | clp->cl_hostname); | 2148 | clp->cl_hostname); |
@@ -2171,7 +2175,7 @@ restart: | |||
2171 | rcu_read_unlock(); | 2175 | rcu_read_unlock(); |
2172 | 2176 | ||
2173 | out: | 2177 | out: |
2174 | put_rpccred(cred); | 2178 | put_cred(cred); |
2175 | return 0; | 2179 | return 0; |
2176 | } | 2180 | } |
2177 | 2181 | ||
@@ -2194,7 +2198,7 @@ int nfs4_discover_server_trunking(struct nfs_client *clp, | |||
2194 | const struct nfs4_state_recovery_ops *ops = | 2198 | const struct nfs4_state_recovery_ops *ops = |
2195 | clp->cl_mvops->reboot_recovery_ops; | 2199 | clp->cl_mvops->reboot_recovery_ops; |
2196 | struct rpc_clnt *clnt; | 2200 | struct rpc_clnt *clnt; |
2197 | struct rpc_cred *cred; | 2201 | const struct cred *cred; |
2198 | int i, status; | 2202 | int i, status; |
2199 | 2203 | ||
2200 | dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname); | 2204 | dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname); |
@@ -2210,7 +2214,7 @@ again: | |||
2210 | goto out_unlock; | 2214 | goto out_unlock; |
2211 | 2215 | ||
2212 | status = ops->detect_trunking(clp, result, cred); | 2216 | status = ops->detect_trunking(clp, result, cred); |
2213 | put_rpccred(cred); | 2217 | put_cred(cred); |
2214 | switch (status) { | 2218 | switch (status) { |
2215 | case 0: | 2219 | case 0: |
2216 | case -EINTR: | 2220 | case -EINTR: |
@@ -2401,7 +2405,7 @@ out_recovery: | |||
2401 | 2405 | ||
2402 | static int nfs4_reset_session(struct nfs_client *clp) | 2406 | static int nfs4_reset_session(struct nfs_client *clp) |
2403 | { | 2407 | { |
2404 | struct rpc_cred *cred; | 2408 | const struct cred *cred; |
2405 | int status; | 2409 | int status; |
2406 | 2410 | ||
2407 | if (!nfs4_has_session(clp)) | 2411 | if (!nfs4_has_session(clp)) |
@@ -2439,14 +2443,13 @@ static int nfs4_reset_session(struct nfs_client *clp) | |||
2439 | dprintk("%s: session reset was successful for server %s!\n", | 2443 | dprintk("%s: session reset was successful for server %s!\n", |
2440 | __func__, clp->cl_hostname); | 2444 | __func__, clp->cl_hostname); |
2441 | out: | 2445 | out: |
2442 | if (cred) | 2446 | put_cred(cred); |
2443 | put_rpccred(cred); | ||
2444 | return status; | 2447 | return status; |
2445 | } | 2448 | } |
2446 | 2449 | ||
2447 | static int nfs4_bind_conn_to_session(struct nfs_client *clp) | 2450 | static int nfs4_bind_conn_to_session(struct nfs_client *clp) |
2448 | { | 2451 | { |
2449 | struct rpc_cred *cred; | 2452 | const struct cred *cred; |
2450 | int ret; | 2453 | int ret; |
2451 | 2454 | ||
2452 | if (!nfs4_has_session(clp)) | 2455 | if (!nfs4_has_session(clp)) |
@@ -2456,8 +2459,7 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp) | |||
2456 | return ret; | 2459 | return ret; |
2457 | cred = nfs4_get_clid_cred(clp); | 2460 | cred = nfs4_get_clid_cred(clp); |
2458 | ret = nfs4_proc_bind_conn_to_session(clp, cred); | 2461 | ret = nfs4_proc_bind_conn_to_session(clp, cred); |
2459 | if (cred) | 2462 | put_cred(cred); |
2460 | put_rpccred(cred); | ||
2461 | clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); | 2463 | clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); |
2462 | switch (ret) { | 2464 | switch (ret) { |
2463 | case 0: | 2465 | case 0: |