mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
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>
This commit is contained in:
committed by
Anna Schumaker
parent
684f39b4cf
commit
a52458b48a
+3
-3
@@ -256,7 +256,7 @@ static int nlm_wait_on_grace(wait_queue_head_t *queue)
|
||||
* Generic NLM call
|
||||
*/
|
||||
static int
|
||||
nlmclnt_call(struct rpc_cred *cred, struct nlm_rqst *req, u32 proc)
|
||||
nlmclnt_call(const struct cred *cred, struct nlm_rqst *req, u32 proc)
|
||||
{
|
||||
struct nlm_host *host = req->a_host;
|
||||
struct rpc_clnt *clnt;
|
||||
@@ -401,7 +401,7 @@ int nlm_async_reply(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *t
|
||||
* completion in order to be able to correctly track the lock
|
||||
* state.
|
||||
*/
|
||||
static int nlmclnt_async_call(struct rpc_cred *cred, struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops)
|
||||
static int nlmclnt_async_call(const struct cred *cred, struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops)
|
||||
{
|
||||
struct rpc_message msg = {
|
||||
.rpc_argp = &req->a_args,
|
||||
@@ -510,7 +510,7 @@ static int do_vfs_lock(struct file_lock *fl)
|
||||
static int
|
||||
nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
|
||||
{
|
||||
struct rpc_cred *cred = nfs_file_cred(fl->fl_file);
|
||||
const struct cred *cred = nfs_file_cred(fl->fl_file);
|
||||
struct nlm_host *host = req->a_host;
|
||||
struct nlm_res *resp = &req->a_res;
|
||||
struct nlm_wait *block = NULL;
|
||||
|
||||
@@ -584,7 +584,7 @@ static int decode_sector_number(__be32 **rp, sector_t *sp)
|
||||
|
||||
static struct nfs4_deviceid_node *
|
||||
bl_find_get_deviceid(struct nfs_server *server,
|
||||
const struct nfs4_deviceid *id, struct rpc_cred *cred,
|
||||
const struct nfs4_deviceid *id, const struct cred *cred,
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
struct nfs4_deviceid_node *node;
|
||||
|
||||
+13
-15
@@ -26,10 +26,8 @@
|
||||
|
||||
static void nfs_free_delegation(struct nfs_delegation *delegation)
|
||||
{
|
||||
if (delegation->cred) {
|
||||
put_rpccred(delegation->cred);
|
||||
delegation->cred = NULL;
|
||||
}
|
||||
put_cred(delegation->cred);
|
||||
delegation->cred = NULL;
|
||||
kfree_rcu(delegation, rcu);
|
||||
}
|
||||
|
||||
@@ -178,13 +176,13 @@ again:
|
||||
* @pagemod_limit: write delegation "space_limit"
|
||||
*
|
||||
*/
|
||||
void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
|
||||
void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred,
|
||||
fmode_t type,
|
||||
const nfs4_stateid *stateid,
|
||||
unsigned long pagemod_limit)
|
||||
{
|
||||
struct nfs_delegation *delegation;
|
||||
struct rpc_cred *oldcred = NULL;
|
||||
const struct cred *oldcred = NULL;
|
||||
|
||||
rcu_read_lock();
|
||||
delegation = rcu_dereference(NFS_I(inode)->delegation);
|
||||
@@ -195,12 +193,12 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
|
||||
delegation->type = type;
|
||||
delegation->pagemod_limit = pagemod_limit;
|
||||
oldcred = delegation->cred;
|
||||
delegation->cred = get_rpccred(cred);
|
||||
delegation->cred = get_cred(cred);
|
||||
clear_bit(NFS_DELEGATION_NEED_RECLAIM,
|
||||
&delegation->flags);
|
||||
spin_unlock(&delegation->lock);
|
||||
rcu_read_unlock();
|
||||
put_rpccred(oldcred);
|
||||
put_cred(oldcred);
|
||||
trace_nfs4_reclaim_delegation(inode, type);
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +339,7 @@ nfs_update_inplace_delegation(struct nfs_delegation *delegation,
|
||||
*
|
||||
* Returns zero on success, or a negative errno value.
|
||||
*/
|
||||
int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred,
|
||||
int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred,
|
||||
fmode_t type,
|
||||
const nfs4_stateid *stateid,
|
||||
unsigned long pagemod_limit)
|
||||
@@ -360,7 +358,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred,
|
||||
delegation->type = type;
|
||||
delegation->pagemod_limit = pagemod_limit;
|
||||
delegation->change_attr = inode_peek_iversion_raw(inode);
|
||||
delegation->cred = get_rpccred(cred);
|
||||
delegation->cred = get_cred(cred);
|
||||
delegation->inode = inode;
|
||||
delegation->flags = 1<<NFS_DELEGATION_REFERENCED;
|
||||
spin_lock_init(&delegation->lock);
|
||||
@@ -1047,7 +1045,7 @@ void nfs_reap_expired_delegations(struct nfs_client *clp)
|
||||
struct nfs_delegation *delegation;
|
||||
struct nfs_server *server;
|
||||
struct inode *inode;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
nfs4_stateid stateid;
|
||||
|
||||
restart:
|
||||
@@ -1069,7 +1067,7 @@ restart:
|
||||
nfs_sb_deactive(server->super);
|
||||
goto restart;
|
||||
}
|
||||
cred = get_rpccred_rcu(delegation->cred);
|
||||
cred = get_cred_rcu(delegation->cred);
|
||||
nfs4_stateid_copy(&stateid, &delegation->stateid);
|
||||
clear_bit(NFS_DELEGATION_TEST_EXPIRED, &delegation->flags);
|
||||
rcu_read_unlock();
|
||||
@@ -1078,7 +1076,7 @@ restart:
|
||||
nfs_revoke_delegation(inode, &stateid);
|
||||
nfs_inode_find_state_and_recover(inode, &stateid);
|
||||
}
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
if (nfs4_server_rebooted(clp)) {
|
||||
nfs_inode_mark_test_expired_delegation(server,inode);
|
||||
iput(inode);
|
||||
@@ -1173,7 +1171,7 @@ out:
|
||||
* otherwise "false" is returned.
|
||||
*/
|
||||
bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags,
|
||||
nfs4_stateid *dst, struct rpc_cred **cred)
|
||||
nfs4_stateid *dst, const struct cred **cred)
|
||||
{
|
||||
struct nfs_inode *nfsi = NFS_I(inode);
|
||||
struct nfs_delegation *delegation;
|
||||
@@ -1187,7 +1185,7 @@ bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags,
|
||||
nfs4_stateid_copy(dst, &delegation->stateid);
|
||||
nfs_mark_delegation_referenced(delegation);
|
||||
if (cred)
|
||||
*cred = get_rpccred(delegation->cred);
|
||||
*cred = get_cred(delegation->cred);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
|
||||
+5
-5
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
struct nfs_delegation {
|
||||
struct list_head super_list;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
struct inode *inode;
|
||||
nfs4_stateid stateid;
|
||||
fmode_t type;
|
||||
@@ -36,9 +36,9 @@ enum {
|
||||
NFS_DELEGATION_TEST_EXPIRED,
|
||||
};
|
||||
|
||||
int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred,
|
||||
int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred,
|
||||
fmode_t type, const nfs4_stateid *stateid, unsigned long pagemod_limit);
|
||||
void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
|
||||
void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred,
|
||||
fmode_t type, const nfs4_stateid *stateid, unsigned long pagemod_limit);
|
||||
int nfs4_inode_return_delegation(struct inode *inode);
|
||||
int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid);
|
||||
@@ -60,10 +60,10 @@ void nfs_mark_test_expired_all_delegations(struct nfs_client *clp);
|
||||
void nfs_reap_expired_delegations(struct nfs_client *clp);
|
||||
|
||||
/* NFSv4 delegation-related procedures */
|
||||
int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid, int issync);
|
||||
int nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, const nfs4_stateid *stateid, int issync);
|
||||
int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid, fmode_t type);
|
||||
int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, const nfs4_stateid *stateid);
|
||||
bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, struct rpc_cred **cred);
|
||||
bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, const struct cred **cred);
|
||||
bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode);
|
||||
|
||||
void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);
|
||||
|
||||
@@ -224,16 +224,14 @@ static struct nfs4_ff_layout_mirror *ff_layout_alloc_mirror(gfp_t gfp_flags)
|
||||
|
||||
static void ff_layout_free_mirror(struct nfs4_ff_layout_mirror *mirror)
|
||||
{
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
|
||||
ff_layout_remove_mirror(mirror);
|
||||
kfree(mirror->fh_versions);
|
||||
cred = rcu_access_pointer(mirror->ro_cred);
|
||||
if (cred)
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
cred = rcu_access_pointer(mirror->rw_cred);
|
||||
if (cred)
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
nfs4_ff_layout_put_deviceid(mirror->mirror_ds);
|
||||
kfree(mirror);
|
||||
}
|
||||
@@ -411,9 +409,8 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
|
||||
|
||||
for (i = 0; i < fls->mirror_array_cnt; i++) {
|
||||
struct nfs4_ff_layout_mirror *mirror;
|
||||
struct auth_cred acred = {};
|
||||
struct rpc_cred __rcu *cred;
|
||||
struct cred *kcred;
|
||||
const struct cred *cred;
|
||||
kuid_t uid;
|
||||
kgid_t gid;
|
||||
u32 ds_count, fh_count, id;
|
||||
@@ -504,15 +501,7 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
|
||||
goto out_err_free;
|
||||
kcred->fsuid = uid;
|
||||
kcred->fsgid = gid;
|
||||
acred.cred = kcred;
|
||||
|
||||
/* find the cred for it */
|
||||
rcu_assign_pointer(cred, rpc_lookup_generic_cred(&acred, 0, gfp_flags));
|
||||
put_cred(kcred);
|
||||
if (IS_ERR(cred)) {
|
||||
rc = PTR_ERR(cred);
|
||||
goto out_err_free;
|
||||
}
|
||||
cred = kcred;
|
||||
|
||||
if (lgr->range.iomode == IOMODE_READ)
|
||||
rcu_assign_pointer(fls->mirror_array[i]->ro_cred, cred);
|
||||
@@ -1714,7 +1703,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
|
||||
struct pnfs_layout_segment *lseg = hdr->lseg;
|
||||
struct nfs4_pnfs_ds *ds;
|
||||
struct rpc_clnt *ds_clnt;
|
||||
struct rpc_cred *ds_cred;
|
||||
const struct cred *ds_cred;
|
||||
loff_t offset = hdr->args.offset;
|
||||
u32 idx = hdr->pgio_mirror_idx;
|
||||
int vers;
|
||||
@@ -1765,7 +1754,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
|
||||
vers == 3 ? &ff_layout_read_call_ops_v3 :
|
||||
&ff_layout_read_call_ops_v4,
|
||||
0, RPC_TASK_SOFTCONN);
|
||||
put_rpccred(ds_cred);
|
||||
put_cred(ds_cred);
|
||||
return PNFS_ATTEMPTED;
|
||||
|
||||
out_failed:
|
||||
@@ -1781,7 +1770,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
|
||||
struct pnfs_layout_segment *lseg = hdr->lseg;
|
||||
struct nfs4_pnfs_ds *ds;
|
||||
struct rpc_clnt *ds_clnt;
|
||||
struct rpc_cred *ds_cred;
|
||||
const struct cred *ds_cred;
|
||||
loff_t offset = hdr->args.offset;
|
||||
int vers;
|
||||
struct nfs_fh *fh;
|
||||
@@ -1830,7 +1819,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
|
||||
vers == 3 ? &ff_layout_write_call_ops_v3 :
|
||||
&ff_layout_write_call_ops_v4,
|
||||
sync, RPC_TASK_SOFTCONN);
|
||||
put_rpccred(ds_cred);
|
||||
put_cred(ds_cred);
|
||||
return PNFS_ATTEMPTED;
|
||||
|
||||
out_failed:
|
||||
@@ -1860,7 +1849,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
||||
struct pnfs_layout_segment *lseg = data->lseg;
|
||||
struct nfs4_pnfs_ds *ds;
|
||||
struct rpc_clnt *ds_clnt;
|
||||
struct rpc_cred *ds_cred;
|
||||
const struct cred *ds_cred;
|
||||
u32 idx;
|
||||
int vers, ret;
|
||||
struct nfs_fh *fh;
|
||||
@@ -1900,7 +1889,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
||||
vers == 3 ? &ff_layout_commit_call_ops_v3 :
|
||||
&ff_layout_commit_call_ops_v4,
|
||||
how, RPC_TASK_SOFTCONN);
|
||||
put_rpccred(ds_cred);
|
||||
put_cred(ds_cred);
|
||||
return ret;
|
||||
out_err:
|
||||
pnfs_generic_prepare_to_resend_writes(data);
|
||||
|
||||
@@ -81,8 +81,8 @@ struct nfs4_ff_layout_mirror {
|
||||
u32 fh_versions_cnt;
|
||||
struct nfs_fh *fh_versions;
|
||||
nfs4_stateid stateid;
|
||||
struct rpc_cred __rcu *ro_cred;
|
||||
struct rpc_cred __rcu *rw_cred;
|
||||
const struct cred __rcu *ro_cred;
|
||||
const struct cred __rcu *rw_cred;
|
||||
refcount_t ref;
|
||||
spinlock_t lock;
|
||||
unsigned long flags;
|
||||
@@ -229,8 +229,8 @@ nfs4_ff_find_or_create_ds_client(struct pnfs_layout_segment *lseg,
|
||||
u32 ds_idx,
|
||||
struct nfs_client *ds_clp,
|
||||
struct inode *inode);
|
||||
struct rpc_cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
|
||||
u32 ds_idx, struct rpc_cred *mdscred);
|
||||
const struct cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
|
||||
u32 ds_idx, const struct cred *mdscred);
|
||||
bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg);
|
||||
bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg);
|
||||
|
||||
|
||||
@@ -330,10 +330,10 @@ int ff_layout_track_ds_error(struct nfs4_flexfile_layout *flo,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rpc_cred *
|
||||
static const struct cred *
|
||||
ff_layout_get_mirror_cred(struct nfs4_ff_layout_mirror *mirror, u32 iomode)
|
||||
{
|
||||
struct rpc_cred *cred, __rcu **pcred;
|
||||
const struct cred *cred, __rcu **pcred;
|
||||
|
||||
if (iomode == IOMODE_READ)
|
||||
pcred = &mirror->ro_cred;
|
||||
@@ -346,7 +346,7 @@ ff_layout_get_mirror_cred(struct nfs4_ff_layout_mirror *mirror, u32 iomode)
|
||||
if (!cred)
|
||||
break;
|
||||
|
||||
cred = get_rpccred_rcu(cred);
|
||||
cred = get_cred_rcu(cred);
|
||||
} while(!cred);
|
||||
rcu_read_unlock();
|
||||
return cred;
|
||||
@@ -465,19 +465,19 @@ out:
|
||||
return ds;
|
||||
}
|
||||
|
||||
struct rpc_cred *
|
||||
const struct cred *
|
||||
ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg, u32 ds_idx,
|
||||
struct rpc_cred *mdscred)
|
||||
const struct cred *mdscred)
|
||||
{
|
||||
struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, ds_idx);
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
|
||||
if (mirror && !mirror->mirror_ds->ds_versions[0].tightly_coupled) {
|
||||
cred = ff_layout_get_mirror_cred(mirror, lseg->pls_range.iomode);
|
||||
if (!cred)
|
||||
cred = get_rpccred(mdscred);
|
||||
cred = get_cred(mdscred);
|
||||
} else {
|
||||
cred = get_rpccred(mdscred);
|
||||
cred = get_cred(mdscred);
|
||||
}
|
||||
return cred;
|
||||
}
|
||||
|
||||
+4
-7
@@ -950,13 +950,11 @@ struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry,
|
||||
struct file *filp)
|
||||
{
|
||||
struct nfs_open_context *ctx;
|
||||
struct rpc_cred *cred = rpc_lookup_cred();
|
||||
if (IS_ERR(cred))
|
||||
return ERR_CAST(cred);
|
||||
const struct cred *cred = get_current_cred();
|
||||
|
||||
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
|
||||
if (!ctx) {
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
nfs_sb_active(dentry->d_sb);
|
||||
@@ -998,8 +996,7 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
|
||||
}
|
||||
if (inode != NULL)
|
||||
NFS_PROTO(inode)->close_context(ctx, is_sync);
|
||||
if (ctx->cred != NULL)
|
||||
put_rpccred(ctx->cred);
|
||||
put_cred(ctx->cred);
|
||||
dput(ctx->dentry);
|
||||
nfs_sb_deactive(sb);
|
||||
put_rpccred(ctx->ll_cred);
|
||||
@@ -1044,7 +1041,7 @@ EXPORT_SYMBOL_GPL(nfs_file_set_open_context);
|
||||
/*
|
||||
* Given an inode, search for an open context with the desired characteristics
|
||||
*/
|
||||
struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode)
|
||||
struct nfs_open_context *nfs_find_open_context(struct inode *inode, const struct cred *cred, fmode_t mode)
|
||||
{
|
||||
struct nfs_inode *nfsi = NFS_I(inode);
|
||||
struct nfs_open_context *pos, *ctx = NULL;
|
||||
|
||||
+4
-4
@@ -254,7 +254,7 @@ struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *);
|
||||
void nfs_pgio_header_free(struct nfs_pgio_header *);
|
||||
int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *);
|
||||
int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
|
||||
struct rpc_cred *cred, const struct nfs_rpc_ops *rpc_ops,
|
||||
const struct cred *cred, const struct nfs_rpc_ops *rpc_ops,
|
||||
const struct rpc_call_ops *call_ops, int how, int flags);
|
||||
void nfs_free_request(struct nfs_page *req);
|
||||
struct nfs_pgio_mirror *
|
||||
@@ -269,7 +269,7 @@ static inline bool nfs_pgio_has_mirroring(struct nfs_pageio_descriptor *desc)
|
||||
static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1,
|
||||
const struct nfs_open_context *ctx2)
|
||||
{
|
||||
return ctx1->cred == ctx2->cred && ctx1->state == ctx2->state;
|
||||
return cred_fscmp(ctx1->cred, ctx2->cred) == 0 && ctx1->state == ctx2->state;
|
||||
}
|
||||
|
||||
/* nfs2xdr.c */
|
||||
@@ -564,10 +564,10 @@ extern struct nfs_client *nfs4_init_client(struct nfs_client *clp,
|
||||
const struct nfs_client_initdata *);
|
||||
extern int nfs40_walk_client_list(struct nfs_client *clp,
|
||||
struct nfs_client **result,
|
||||
struct rpc_cred *cred);
|
||||
const struct cred *cred);
|
||||
extern int nfs41_walk_client_list(struct nfs_client *clp,
|
||||
struct nfs_client **result,
|
||||
struct rpc_cred *cred);
|
||||
const struct cred *cred);
|
||||
extern int nfs4_test_session_trunk(struct rpc_clnt *,
|
||||
struct rpc_xprt *,
|
||||
void *);
|
||||
|
||||
+2
-16
@@ -195,20 +195,15 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
|
||||
.access = entry->mask,
|
||||
};
|
||||
struct nfs3_accessres res;
|
||||
struct auth_cred acred = {
|
||||
.cred = entry->cred,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS],
|
||||
.rpc_argp = &arg,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = rpc_lookup_generic_cred(&acred, 0, GFP_NOFS),
|
||||
.rpc_cred = entry->cred,
|
||||
};
|
||||
int status = -ENOMEM;
|
||||
|
||||
dprintk("NFS call access\n");
|
||||
if (!msg.rpc_cred)
|
||||
goto out;
|
||||
res.fattr = nfs_alloc_fattr();
|
||||
if (res.fattr == NULL)
|
||||
goto out;
|
||||
@@ -219,8 +214,6 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
|
||||
nfs_access_set_mask(entry, res.access);
|
||||
nfs_free_fattr(res.fattr);
|
||||
out:
|
||||
if (msg.rpc_cred)
|
||||
put_rpccred(msg.rpc_cred);
|
||||
dprintk("NFS reply access: %d\n", status);
|
||||
return status;
|
||||
}
|
||||
@@ -631,15 +624,11 @@ nfs3_proc_readdir(struct dentry *dentry, const struct cred *cred,
|
||||
.verf = verf,
|
||||
.plus = plus
|
||||
};
|
||||
struct auth_cred acred = {
|
||||
.cred = cred,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs3_procedures[NFS3PROC_READDIR],
|
||||
.rpc_argp = &arg,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = rpc_lookup_generic_cred(&acred,
|
||||
0, GFP_NOFS),
|
||||
.rpc_cred = cred,
|
||||
};
|
||||
int status = -ENOMEM;
|
||||
|
||||
@@ -649,8 +638,6 @@ nfs3_proc_readdir(struct dentry *dentry, const struct cred *cred,
|
||||
dprintk("NFS call readdir%s %d\n",
|
||||
plus? "plus" : "", (unsigned int) cookie);
|
||||
|
||||
if (!msg.rpc_cred)
|
||||
return -ENOMEM;
|
||||
res.dir_attr = nfs_alloc_fattr();
|
||||
if (res.dir_attr == NULL)
|
||||
goto out;
|
||||
@@ -662,7 +649,6 @@ nfs3_proc_readdir(struct dentry *dentry, const struct cred *cred,
|
||||
|
||||
nfs_free_fattr(res.dir_attr);
|
||||
out:
|
||||
put_rpccred(msg.rpc_cred);
|
||||
dprintk("NFS reply readdir%s: %d\n",
|
||||
plus? "plus" : "", status);
|
||||
return status;
|
||||
|
||||
+28
-28
@@ -62,7 +62,7 @@ struct nfs4_minor_version_ops {
|
||||
void (*free_lock_state)(struct nfs_server *,
|
||||
struct nfs4_lock_state *);
|
||||
int (*test_and_free_expired)(struct nfs_server *,
|
||||
nfs4_stateid *, struct rpc_cred *);
|
||||
nfs4_stateid *, const struct cred *);
|
||||
struct nfs_seqid *
|
||||
(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t);
|
||||
int (*session_trunk)(struct rpc_clnt *, struct rpc_xprt *, void *);
|
||||
@@ -107,7 +107,7 @@ struct nfs4_state_owner {
|
||||
unsigned long so_expires;
|
||||
struct rb_node so_server_node;
|
||||
|
||||
struct rpc_cred *so_cred; /* Associated cred */
|
||||
const struct cred *so_cred; /* Associated cred */
|
||||
|
||||
spinlock_t so_lock;
|
||||
atomic_t so_count;
|
||||
@@ -212,10 +212,10 @@ struct nfs4_state_recovery_ops {
|
||||
int state_flag_bit;
|
||||
int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *);
|
||||
int (*recover_lock)(struct nfs4_state *, struct file_lock *);
|
||||
int (*establish_clid)(struct nfs_client *, struct rpc_cred *);
|
||||
int (*reclaim_complete)(struct nfs_client *, struct rpc_cred *);
|
||||
int (*establish_clid)(struct nfs_client *, const struct cred *);
|
||||
int (*reclaim_complete)(struct nfs_client *, const struct cred *);
|
||||
int (*detect_trunking)(struct nfs_client *, struct nfs_client **,
|
||||
struct rpc_cred *);
|
||||
const struct cred *);
|
||||
};
|
||||
|
||||
struct nfs4_opendata {
|
||||
@@ -245,19 +245,19 @@ struct nfs4_opendata {
|
||||
|
||||
struct nfs4_add_xprt_data {
|
||||
struct nfs_client *clp;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
};
|
||||
|
||||
struct nfs4_state_maintenance_ops {
|
||||
int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *, unsigned);
|
||||
struct rpc_cred * (*get_state_renewal_cred)(struct nfs_client *);
|
||||
int (*renew_lease)(struct nfs_client *, struct rpc_cred *);
|
||||
int (*sched_state_renewal)(struct nfs_client *, const struct cred *, unsigned);
|
||||
const struct cred * (*get_state_renewal_cred)(struct nfs_client *);
|
||||
int (*renew_lease)(struct nfs_client *, const struct cred *);
|
||||
};
|
||||
|
||||
struct nfs4_mig_recovery_ops {
|
||||
int (*get_locations)(struct inode *, struct nfs4_fs_locations *,
|
||||
struct page *, struct rpc_cred *);
|
||||
int (*fsid_present)(struct inode *, struct rpc_cred *);
|
||||
struct page *, const struct cred *);
|
||||
int (*fsid_present)(struct inode *, const struct cred *);
|
||||
};
|
||||
|
||||
extern const struct dentry_operations nfs4_dentry_operations;
|
||||
@@ -286,21 +286,21 @@ extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
|
||||
struct rpc_message *, struct nfs4_sequence_args *,
|
||||
struct nfs4_sequence_res *, int);
|
||||
extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
|
||||
extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *);
|
||||
extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *);
|
||||
extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *);
|
||||
extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *);
|
||||
extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *, bool);
|
||||
extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, struct rpc_cred *cred);
|
||||
extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred);
|
||||
extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, const struct cred *cred);
|
||||
extern int nfs4_proc_exchange_id(struct nfs_client *clp, const struct cred *cred);
|
||||
extern int nfs4_destroy_clientid(struct nfs_client *clp);
|
||||
extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *);
|
||||
extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *);
|
||||
extern int nfs4_init_clientid(struct nfs_client *, const struct cred *);
|
||||
extern int nfs41_init_clientid(struct nfs_client *, const struct cred *);
|
||||
extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait);
|
||||
extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
|
||||
extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *,
|
||||
struct nfs4_fs_locations *, struct page *);
|
||||
extern int nfs4_proc_get_locations(struct inode *, struct nfs4_fs_locations *,
|
||||
struct page *page, struct rpc_cred *);
|
||||
extern int nfs4_proc_fsid_present(struct inode *, struct rpc_cred *);
|
||||
struct page *page, const struct cred *);
|
||||
extern int nfs4_proc_fsid_present(struct inode *, const struct cred *);
|
||||
extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, const struct qstr *,
|
||||
struct nfs_fh *, struct nfs_fattr *);
|
||||
extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
|
||||
@@ -312,8 +312,8 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid,
|
||||
|
||||
#if defined(CONFIG_NFS_V4_1)
|
||||
extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
|
||||
extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *);
|
||||
extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *);
|
||||
extern int nfs4_proc_create_session(struct nfs_client *, const struct cred *);
|
||||
extern int nfs4_proc_destroy_session(struct nfs4_session *, const struct cred *);
|
||||
extern int nfs4_proc_get_lease_time(struct nfs_client *clp,
|
||||
struct nfs_fsinfo *fsinfo);
|
||||
extern int nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data,
|
||||
@@ -443,16 +443,16 @@ extern void nfs4_set_lease_period(struct nfs_client *clp,
|
||||
|
||||
|
||||
/* nfs4state.c */
|
||||
struct rpc_cred *nfs4_get_clid_cred(struct nfs_client *clp);
|
||||
struct rpc_cred *nfs4_get_machine_cred(struct nfs_client *clp);
|
||||
struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp);
|
||||
const struct cred *nfs4_get_clid_cred(struct nfs_client *clp);
|
||||
const struct cred *nfs4_get_machine_cred(struct nfs_client *clp);
|
||||
const struct cred *nfs4_get_renew_cred(struct nfs_client *clp);
|
||||
int nfs4_discover_server_trunking(struct nfs_client *clp,
|
||||
struct nfs_client **);
|
||||
int nfs40_discover_server_trunking(struct nfs_client *clp,
|
||||
struct nfs_client **, struct rpc_cred *);
|
||||
struct nfs_client **, const struct cred *);
|
||||
#if defined(CONFIG_NFS_V4_1)
|
||||
int nfs41_discover_server_trunking(struct nfs_client *clp,
|
||||
struct nfs_client **, struct rpc_cred *);
|
||||
struct nfs_client **, const struct cred *);
|
||||
extern void nfs4_schedule_session_recovery(struct nfs4_session *, int);
|
||||
extern void nfs41_notify_server(struct nfs_client *);
|
||||
#else
|
||||
@@ -461,7 +461,7 @@ static inline void nfs4_schedule_session_recovery(struct nfs4_session *session,
|
||||
}
|
||||
#endif /* CONFIG_NFS_V4_1 */
|
||||
|
||||
extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *, gfp_t);
|
||||
extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, const struct cred *, gfp_t);
|
||||
extern void nfs4_put_state_owner(struct nfs4_state_owner *);
|
||||
extern void nfs4_purge_state_owners(struct nfs_server *);
|
||||
extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
|
||||
@@ -487,7 +487,7 @@ extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
|
||||
extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
|
||||
extern int nfs4_select_rw_stateid(struct nfs4_state *, fmode_t,
|
||||
const struct nfs_lock_context *, nfs4_stateid *,
|
||||
struct rpc_cred **);
|
||||
const struct cred **);
|
||||
extern bool nfs4_refresh_open_stateid(nfs4_stateid *dst,
|
||||
struct nfs4_state *state);
|
||||
extern bool nfs4_copy_open_stateid(nfs4_stateid *dst,
|
||||
|
||||
+2
-2
@@ -545,7 +545,7 @@ static int nfs4_match_client(struct nfs_client *pos, struct nfs_client *new,
|
||||
*/
|
||||
int nfs40_walk_client_list(struct nfs_client *new,
|
||||
struct nfs_client **result,
|
||||
struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id);
|
||||
struct nfs_client *pos, *prev = NULL;
|
||||
@@ -711,7 +711,7 @@ out_err:
|
||||
*/
|
||||
int nfs41_walk_client_list(struct nfs_client *new,
|
||||
struct nfs_client **result,
|
||||
struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id);
|
||||
struct nfs_client *pos, *prev = NULL;
|
||||
|
||||
+72
-95
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -57,7 +57,7 @@ nfs4_renew_state(struct work_struct *work)
|
||||
const struct nfs4_state_maintenance_ops *ops;
|
||||
struct nfs_client *clp =
|
||||
container_of(work, struct nfs_client, cl_renewd.work);
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
long lease;
|
||||
unsigned long last, now;
|
||||
unsigned renew_flags = 0;
|
||||
@@ -90,7 +90,7 @@ nfs4_renew_state(struct work_struct *work)
|
||||
|
||||
/* Queue an asynchronous RENEW. */
|
||||
ret = ops->sched_state_renewal(clp, cred, renew_flags);
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
switch (ret) {
|
||||
default:
|
||||
goto out_exp;
|
||||
|
||||
@@ -573,12 +573,11 @@ static void nfs4_destroy_session_slot_tables(struct nfs4_session *session)
|
||||
void nfs4_destroy_session(struct nfs4_session *session)
|
||||
{
|
||||
struct rpc_xprt *xprt;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
|
||||
cred = nfs4_get_clid_cred(session->clp);
|
||||
nfs4_proc_destroy_session(session, cred);
|
||||
if (cred)
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
|
||||
rcu_read_lock();
|
||||
xprt = rcu_dereference(session->clp->cl_rpcclient->cl_xprt);
|
||||
|
||||
+47
-45
@@ -87,7 +87,7 @@ const nfs4_stateid current_stateid = {
|
||||
|
||||
static DEFINE_MUTEX(nfs_clid_init_mutex);
|
||||
|
||||
int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
|
||||
int nfs4_init_clientid(struct nfs_client *clp, const struct cred *cred)
|
||||
{
|
||||
struct nfs4_setclientid_res clid = {
|
||||
.clientid = clp->cl_clientid,
|
||||
@@ -134,7 +134,7 @@ out:
|
||||
*/
|
||||
int nfs40_discover_server_trunking(struct nfs_client *clp,
|
||||
struct nfs_client **result,
|
||||
struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
struct nfs4_setclientid_res clid = {
|
||||
.clientid = clp->cl_clientid,
|
||||
@@ -164,9 +164,9 @@ out:
|
||||
return status;
|
||||
}
|
||||
|
||||
struct rpc_cred *nfs4_get_machine_cred(struct nfs_client *clp)
|
||||
const struct cred *nfs4_get_machine_cred(struct nfs_client *clp)
|
||||
{
|
||||
return get_rpccred(rpc_machine_cred());
|
||||
return get_cred(rpc_machine_cred());
|
||||
}
|
||||
|
||||
static void nfs4_root_machine_cred(struct nfs_client *clp)
|
||||
@@ -177,10 +177,10 @@ static void nfs4_root_machine_cred(struct nfs_client *clp)
|
||||
clp->cl_rpcclient->cl_principal = NULL;
|
||||
}
|
||||
|
||||
static struct rpc_cred *
|
||||
static const struct cred *
|
||||
nfs4_get_renew_cred_server_locked(struct nfs_server *server)
|
||||
{
|
||||
struct rpc_cred *cred = NULL;
|
||||
const struct cred *cred = NULL;
|
||||
struct nfs4_state_owner *sp;
|
||||
struct rb_node *pos;
|
||||
|
||||
@@ -190,7 +190,7 @@ nfs4_get_renew_cred_server_locked(struct nfs_server *server)
|
||||
sp = rb_entry(pos, struct nfs4_state_owner, so_server_node);
|
||||
if (list_empty(&sp->so_states))
|
||||
continue;
|
||||
cred = get_rpccred(sp->so_cred);
|
||||
cred = get_cred(sp->so_cred);
|
||||
break;
|
||||
}
|
||||
return cred;
|
||||
@@ -203,9 +203,9 @@ nfs4_get_renew_cred_server_locked(struct nfs_server *server)
|
||||
* Returns an rpc_cred with reference count bumped, or NULL.
|
||||
* Caller must hold clp->cl_lock.
|
||||
*/
|
||||
struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
|
||||
const struct cred *nfs4_get_renew_cred(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_cred *cred = NULL;
|
||||
const struct cred *cred = NULL;
|
||||
struct nfs_server *server;
|
||||
|
||||
/* Use machine credentials if available */
|
||||
@@ -312,7 +312,7 @@ static void nfs41_finish_session_reset(struct nfs_client *clp)
|
||||
nfs41_setup_state_renewal(clp);
|
||||
}
|
||||
|
||||
int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
|
||||
int nfs41_init_clientid(struct nfs_client *clp, const struct cred *cred)
|
||||
{
|
||||
int status;
|
||||
|
||||
@@ -347,7 +347,7 @@ out:
|
||||
*/
|
||||
int nfs41_discover_server_trunking(struct nfs_client *clp,
|
||||
struct nfs_client **result,
|
||||
struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
int status;
|
||||
|
||||
@@ -385,30 +385,32 @@ int nfs41_discover_server_trunking(struct nfs_client *clp,
|
||||
* nfs4_get_clid_cred - Acquire credential for a setclientid operation
|
||||
* @clp: client state handle
|
||||
*
|
||||
* Returns an rpc_cred with reference count bumped, or NULL.
|
||||
* Returns a cred with reference count bumped, or NULL.
|
||||
*/
|
||||
struct rpc_cred *nfs4_get_clid_cred(struct nfs_client *clp)
|
||||
const struct cred *nfs4_get_clid_cred(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
|
||||
cred = nfs4_get_machine_cred(clp);
|
||||
return cred;
|
||||
}
|
||||
|
||||
static struct nfs4_state_owner *
|
||||
nfs4_find_state_owner_locked(struct nfs_server *server, struct rpc_cred *cred)
|
||||
nfs4_find_state_owner_locked(struct nfs_server *server, const struct cred *cred)
|
||||
{
|
||||
struct rb_node **p = &server->state_owners.rb_node,
|
||||
*parent = NULL;
|
||||
struct nfs4_state_owner *sp;
|
||||
int cmp;
|
||||
|
||||
while (*p != NULL) {
|
||||
parent = *p;
|
||||
sp = rb_entry(parent, struct nfs4_state_owner, so_server_node);
|
||||
cmp = cred_fscmp(cred, sp->so_cred);
|
||||
|
||||
if (cred < sp->so_cred)
|
||||
if (cmp < 0)
|
||||
p = &parent->rb_left;
|
||||
else if (cred > sp->so_cred)
|
||||
else if (cmp > 0)
|
||||
p = &parent->rb_right;
|
||||
else {
|
||||
if (!list_empty(&sp->so_lru))
|
||||
@@ -427,14 +429,16 @@ nfs4_insert_state_owner_locked(struct nfs4_state_owner *new)
|
||||
struct rb_node **p = &server->state_owners.rb_node,
|
||||
*parent = NULL;
|
||||
struct nfs4_state_owner *sp;
|
||||
int cmp;
|
||||
|
||||
while (*p != NULL) {
|
||||
parent = *p;
|
||||
sp = rb_entry(parent, struct nfs4_state_owner, so_server_node);
|
||||
cmp = cred_fscmp(new->so_cred, sp->so_cred);
|
||||
|
||||
if (new->so_cred < sp->so_cred)
|
||||
if (cmp < 0)
|
||||
p = &parent->rb_left;
|
||||
else if (new->so_cred > sp->so_cred)
|
||||
else if (cmp > 0)
|
||||
p = &parent->rb_right;
|
||||
else {
|
||||
if (!list_empty(&sp->so_lru))
|
||||
@@ -481,7 +485,7 @@ nfs4_destroy_seqid_counter(struct nfs_seqid_counter *sc)
|
||||
*/
|
||||
static struct nfs4_state_owner *
|
||||
nfs4_alloc_state_owner(struct nfs_server *server,
|
||||
struct rpc_cred *cred,
|
||||
const struct cred *cred,
|
||||
gfp_t gfp_flags)
|
||||
{
|
||||
struct nfs4_state_owner *sp;
|
||||
@@ -496,7 +500,7 @@ nfs4_alloc_state_owner(struct nfs_server *server,
|
||||
return NULL;
|
||||
}
|
||||
sp->so_server = server;
|
||||
sp->so_cred = get_rpccred(cred);
|
||||
sp->so_cred = get_cred(cred);
|
||||
spin_lock_init(&sp->so_lock);
|
||||
INIT_LIST_HEAD(&sp->so_states);
|
||||
nfs4_init_seqid_counter(&sp->so_seqid);
|
||||
@@ -525,7 +529,7 @@ nfs4_reset_state_owner(struct nfs4_state_owner *sp)
|
||||
static void nfs4_free_state_owner(struct nfs4_state_owner *sp)
|
||||
{
|
||||
nfs4_destroy_seqid_counter(&sp->so_seqid);
|
||||
put_rpccred(sp->so_cred);
|
||||
put_cred(sp->so_cred);
|
||||
ida_simple_remove(&sp->so_server->openowner_id, sp->so_seqid.owner_id);
|
||||
kfree(sp);
|
||||
}
|
||||
@@ -563,7 +567,7 @@ static void nfs4_gc_state_owners(struct nfs_server *server)
|
||||
* Returns a pointer to an instantiated nfs4_state_owner struct, or NULL.
|
||||
*/
|
||||
struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,
|
||||
struct rpc_cred *cred,
|
||||
const struct cred *cred,
|
||||
gfp_t gfp_flags)
|
||||
{
|
||||
struct nfs_client *clp = server->nfs_client;
|
||||
@@ -1032,7 +1036,7 @@ bool nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)
|
||||
*/
|
||||
int nfs4_select_rw_stateid(struct nfs4_state *state,
|
||||
fmode_t fmode, const struct nfs_lock_context *l_ctx,
|
||||
nfs4_stateid *dst, struct rpc_cred **cred)
|
||||
nfs4_stateid *dst, const struct cred **cred)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -1732,7 +1736,7 @@ static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp)
|
||||
|
||||
static int nfs4_reclaim_complete(struct nfs_client *clp,
|
||||
const struct nfs4_state_recovery_ops *ops,
|
||||
struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
/* Notify the server we're done reclaiming our state */
|
||||
if (ops->reclaim_complete)
|
||||
@@ -1783,7 +1787,7 @@ static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp)
|
||||
static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
|
||||
{
|
||||
const struct nfs4_state_recovery_ops *ops;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
int err;
|
||||
|
||||
if (!nfs4_state_clear_reclaim_reboot(clp))
|
||||
@@ -1791,7 +1795,7 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
|
||||
ops = clp->cl_mvops->reboot_recovery_ops;
|
||||
cred = nfs4_get_clid_cred(clp);
|
||||
err = nfs4_reclaim_complete(clp, ops, cred);
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
if (err == -NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
|
||||
set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
|
||||
}
|
||||
@@ -1887,7 +1891,7 @@ restart:
|
||||
|
||||
static int nfs4_check_lease(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
const struct nfs4_state_maintenance_ops *ops =
|
||||
clp->cl_mvops->state_renewal_ops;
|
||||
int status;
|
||||
@@ -1903,7 +1907,7 @@ static int nfs4_check_lease(struct nfs_client *clp)
|
||||
goto out;
|
||||
}
|
||||
status = ops->renew_lease(clp, cred);
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
if (status == -ETIMEDOUT) {
|
||||
set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
|
||||
return 0;
|
||||
@@ -1963,7 +1967,7 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
|
||||
|
||||
static int nfs4_establish_lease(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
const struct nfs4_state_recovery_ops *ops =
|
||||
clp->cl_mvops->reboot_recovery_ops;
|
||||
int status;
|
||||
@@ -1975,7 +1979,7 @@ static int nfs4_establish_lease(struct nfs_client *clp)
|
||||
if (cred == NULL)
|
||||
return -ENOENT;
|
||||
status = ops->establish_clid(clp, cred);
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
if (status != 0)
|
||||
return status;
|
||||
pnfs_destroy_all_layouts(clp);
|
||||
@@ -2022,7 +2026,7 @@ static int nfs4_purge_lease(struct nfs_client *clp)
|
||||
*
|
||||
* Returns zero or a negative NFS4ERR status code.
|
||||
*/
|
||||
static int nfs4_try_migration(struct nfs_server *server, struct rpc_cred *cred)
|
||||
static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred)
|
||||
{
|
||||
struct nfs_client *clp = server->nfs_client;
|
||||
struct nfs4_fs_locations *locations = NULL;
|
||||
@@ -2092,7 +2096,7 @@ static int nfs4_handle_migration(struct nfs_client *clp)
|
||||
const struct nfs4_state_maintenance_ops *ops =
|
||||
clp->cl_mvops->state_renewal_ops;
|
||||
struct nfs_server *server;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
|
||||
dprintk("%s: migration reported on \"%s\"\n", __func__,
|
||||
clp->cl_hostname);
|
||||
@@ -2118,13 +2122,13 @@ restart:
|
||||
rcu_read_unlock();
|
||||
status = nfs4_try_migration(server, cred);
|
||||
if (status < 0) {
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
return status;
|
||||
}
|
||||
goto restart;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2138,7 +2142,7 @@ static int nfs4_handle_lease_moved(struct nfs_client *clp)
|
||||
const struct nfs4_state_maintenance_ops *ops =
|
||||
clp->cl_mvops->state_renewal_ops;
|
||||
struct nfs_server *server;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
|
||||
dprintk("%s: lease moved reported on \"%s\"\n", __func__,
|
||||
clp->cl_hostname);
|
||||
@@ -2171,7 +2175,7 @@ restart:
|
||||
rcu_read_unlock();
|
||||
|
||||
out:
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2194,7 +2198,7 @@ int nfs4_discover_server_trunking(struct nfs_client *clp,
|
||||
const struct nfs4_state_recovery_ops *ops =
|
||||
clp->cl_mvops->reboot_recovery_ops;
|
||||
struct rpc_clnt *clnt;
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
int i, status;
|
||||
|
||||
dprintk("NFS: %s: testing '%s'\n", __func__, clp->cl_hostname);
|
||||
@@ -2210,7 +2214,7 @@ again:
|
||||
goto out_unlock;
|
||||
|
||||
status = ops->detect_trunking(clp, result, cred);
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
switch (status) {
|
||||
case 0:
|
||||
case -EINTR:
|
||||
@@ -2401,7 +2405,7 @@ out_recovery:
|
||||
|
||||
static int nfs4_reset_session(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
int status;
|
||||
|
||||
if (!nfs4_has_session(clp))
|
||||
@@ -2439,14 +2443,13 @@ static int nfs4_reset_session(struct nfs_client *clp)
|
||||
dprintk("%s: session reset was successful for server %s!\n",
|
||||
__func__, clp->cl_hostname);
|
||||
out:
|
||||
if (cred)
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
return status;
|
||||
}
|
||||
|
||||
static int nfs4_bind_conn_to_session(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_cred *cred;
|
||||
const struct cred *cred;
|
||||
int ret;
|
||||
|
||||
if (!nfs4_has_session(clp))
|
||||
@@ -2456,8 +2459,7 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp)
|
||||
return ret;
|
||||
cred = nfs4_get_clid_cred(clp);
|
||||
ret = nfs4_proc_bind_conn_to_session(clp, cred);
|
||||
if (cred)
|
||||
put_rpccred(cred);
|
||||
put_cred(cred);
|
||||
clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
|
||||
switch (ret) {
|
||||
case 0:
|
||||
|
||||
+1
-1
@@ -587,7 +587,7 @@ static void nfs_pgio_prepare(struct rpc_task *task, void *calldata)
|
||||
}
|
||||
|
||||
int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
|
||||
struct rpc_cred *cred, const struct nfs_rpc_ops *rpc_ops,
|
||||
const struct cred *cred, const struct nfs_rpc_ops *rpc_ops,
|
||||
const struct rpc_call_ops *call_ops, int how, int flags)
|
||||
{
|
||||
struct rpc_task *task;
|
||||
|
||||
+7
-7
@@ -275,7 +275,7 @@ pnfs_free_layout_hdr(struct pnfs_layout_hdr *lo)
|
||||
list_del_init(&lo->plh_layouts);
|
||||
spin_unlock(&clp->cl_lock);
|
||||
}
|
||||
put_rpccred(lo->plh_lc_cred);
|
||||
put_cred(lo->plh_lc_cred);
|
||||
return ld->free_layout_hdr(lo);
|
||||
}
|
||||
|
||||
@@ -1038,7 +1038,7 @@ pnfs_alloc_init_layoutget_args(struct inode *ino,
|
||||
lgp->args.ctx = get_nfs_open_context(ctx);
|
||||
nfs4_stateid_copy(&lgp->args.stateid, stateid);
|
||||
lgp->gfp_flags = gfp_flags;
|
||||
lgp->cred = get_rpccred(ctx->cred);
|
||||
lgp->cred = get_cred(ctx->cred);
|
||||
return lgp;
|
||||
}
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void pnfs_layoutget_free(struct nfs4_layoutget *lgp)
|
||||
nfs4_free_pages(lgp->args.layout.pages, max_pages);
|
||||
if (lgp->args.inode)
|
||||
pnfs_put_layout_hdr(NFS_I(lgp->args.inode)->layout);
|
||||
put_rpccred(lgp->cred);
|
||||
put_cred(lgp->cred);
|
||||
put_nfs_open_context(lgp->args.ctx);
|
||||
kfree(lgp);
|
||||
}
|
||||
@@ -1324,7 +1324,7 @@ pnfs_commit_and_return_layout(struct inode *inode)
|
||||
bool pnfs_roc(struct inode *ino,
|
||||
struct nfs4_layoutreturn_args *args,
|
||||
struct nfs4_layoutreturn_res *res,
|
||||
const struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
struct nfs_inode *nfsi = NFS_I(ino);
|
||||
struct nfs_open_context *ctx;
|
||||
@@ -1583,7 +1583,7 @@ alloc_init_layout_hdr(struct inode *ino,
|
||||
INIT_LIST_HEAD(&lo->plh_return_segs);
|
||||
INIT_LIST_HEAD(&lo->plh_bulk_destroy);
|
||||
lo->plh_inode = ino;
|
||||
lo->plh_lc_cred = get_rpccred(ctx->cred);
|
||||
lo->plh_lc_cred = get_cred(ctx->cred);
|
||||
lo->plh_flags |= 1 << NFS_LAYOUT_INVALID_STID;
|
||||
return lo;
|
||||
}
|
||||
@@ -2928,7 +2928,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
|
||||
spin_unlock(&inode->i_lock);
|
||||
|
||||
data->args.inode = inode;
|
||||
data->cred = get_rpccred(nfsi->layout->plh_lc_cred);
|
||||
data->cred = get_cred(nfsi->layout->plh_lc_cred);
|
||||
nfs_fattr_init(&data->fattr);
|
||||
data->args.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask;
|
||||
data->res.fattr = &data->fattr;
|
||||
@@ -2941,7 +2941,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
|
||||
if (ld->prepare_layoutcommit) {
|
||||
status = ld->prepare_layoutcommit(&data->args);
|
||||
if (status) {
|
||||
put_rpccred(data->cred);
|
||||
put_cred(data->cred);
|
||||
spin_lock(&inode->i_lock);
|
||||
set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags);
|
||||
if (end_pos > nfsi->layout->plh_lwb)
|
||||
|
||||
+5
-5
@@ -200,7 +200,7 @@ struct pnfs_layout_hdr {
|
||||
u32 plh_return_seq;
|
||||
enum pnfs_iomode plh_return_iomode;
|
||||
loff_t plh_lwb; /* last write byte for layoutcommit */
|
||||
struct rpc_cred *plh_lc_cred; /* layoutcommit cred */
|
||||
const struct cred *plh_lc_cred; /* layoutcommit cred */
|
||||
struct inode *plh_inode;
|
||||
};
|
||||
|
||||
@@ -230,7 +230,7 @@ extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *);
|
||||
extern size_t max_response_pages(struct nfs_server *server);
|
||||
extern int nfs4_proc_getdeviceinfo(struct nfs_server *server,
|
||||
struct pnfs_device *dev,
|
||||
struct rpc_cred *cred);
|
||||
const struct cred *cred);
|
||||
extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout);
|
||||
extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync);
|
||||
|
||||
@@ -280,7 +280,7 @@ int pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
|
||||
bool pnfs_roc(struct inode *ino,
|
||||
struct nfs4_layoutreturn_args *args,
|
||||
struct nfs4_layoutreturn_res *res,
|
||||
const struct rpc_cred *cred);
|
||||
const struct cred *cred);
|
||||
void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
|
||||
struct nfs4_layoutreturn_res *res,
|
||||
int ret);
|
||||
@@ -343,7 +343,7 @@ struct nfs4_deviceid_node {
|
||||
|
||||
struct nfs4_deviceid_node *
|
||||
nfs4_find_get_deviceid(struct nfs_server *server,
|
||||
const struct nfs4_deviceid *id, struct rpc_cred *cred,
|
||||
const struct nfs4_deviceid *id, const struct cred *cred,
|
||||
gfp_t gfp_mask);
|
||||
void nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *);
|
||||
void nfs4_init_deviceid_node(struct nfs4_deviceid_node *, struct nfs_server *,
|
||||
@@ -694,7 +694,7 @@ static inline bool
|
||||
pnfs_roc(struct inode *ino,
|
||||
struct nfs4_layoutreturn_args *args,
|
||||
struct nfs4_layoutreturn_res *res,
|
||||
const struct rpc_cred *cred)
|
||||
const struct cred *cred)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -94,7 +94,7 @@ _lookup_deviceid(const struct pnfs_layoutdriver_type *ld,
|
||||
static struct nfs4_deviceid_node *
|
||||
nfs4_get_device_info(struct nfs_server *server,
|
||||
const struct nfs4_deviceid *dev_id,
|
||||
struct rpc_cred *cred, gfp_t gfp_flags)
|
||||
const struct cred *cred, gfp_t gfp_flags)
|
||||
{
|
||||
struct nfs4_deviceid_node *d = NULL;
|
||||
struct pnfs_device *pdev = NULL;
|
||||
@@ -184,7 +184,7 @@ __nfs4_find_get_deviceid(struct nfs_server *server,
|
||||
|
||||
struct nfs4_deviceid_node *
|
||||
nfs4_find_get_deviceid(struct nfs_server *server,
|
||||
const struct nfs4_deviceid *id, struct rpc_cred *cred,
|
||||
const struct nfs4_deviceid *id, const struct cred *cred,
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
long hash = nfs4_deviceid_hash(id);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user