Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46a5ab47 authored by Peng Tao's avatar Peng Tao Committed by Tom Haynes
Browse files

nfs: allow to specify cred in nfs_initiate_pgio



so that flexfile layout client can pass in DS credential instead of
using user cred, which will be done in the next patch.

Signed-off-by: default avatarPeng Tao <tao.peng@primarydata.com>
Signed-off-by: default avatarTom Haynes <Thomas.Haynes@primarydata.com>
parent 2c4b131d
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -501,8 +501,9 @@ filelayout_read_pagelist(struct nfs_pgio_header *hdr)
	hdr->mds_offset = offset;
	hdr->mds_offset = offset;


	/* Perform an asynchronous read to ds */
	/* Perform an asynchronous read to ds */
	nfs_initiate_pgio(ds_clnt, hdr, NFS_PROTO(hdr->inode),
	nfs_initiate_pgio(ds_clnt, hdr, hdr->cred,
			    &filelayout_read_call_ops, 0, RPC_TASK_SOFTCONN);
			  NFS_PROTO(hdr->inode), &filelayout_read_call_ops,
			  0, RPC_TASK_SOFTCONN);
	return PNFS_ATTEMPTED;
	return PNFS_ATTEMPTED;
}
}


@@ -542,9 +543,9 @@ filelayout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
	hdr->args.offset = filelayout_get_dserver_offset(lseg, offset);
	hdr->args.offset = filelayout_get_dserver_offset(lseg, offset);


	/* Perform an asynchronous write */
	/* Perform an asynchronous write */
	nfs_initiate_pgio(ds_clnt, hdr, NFS_PROTO(hdr->inode),
	nfs_initiate_pgio(ds_clnt, hdr, hdr->cred,
				    &filelayout_write_call_ops, sync,
			  NFS_PROTO(hdr->inode), &filelayout_write_call_ops,
				    RPC_TASK_SOFTCONN);
			  sync, RPC_TASK_SOFTCONN);
	return PNFS_ATTEMPTED;
	return PNFS_ATTEMPTED;
}
}


+3 −3
Original line number Original line Diff line number Diff line
@@ -250,9 +250,9 @@ struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *);
void nfs_pgio_header_free(struct nfs_pgio_header *);
void nfs_pgio_header_free(struct nfs_pgio_header *);
void nfs_pgio_data_destroy(struct nfs_pgio_header *);
void nfs_pgio_data_destroy(struct nfs_pgio_header *);
int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *);
int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *);
int nfs_initiate_pgio(struct rpc_clnt *, struct nfs_pgio_header *,
int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
		      const struct nfs_rpc_ops *,
		      struct rpc_cred *cred, const struct nfs_rpc_ops *rpc_ops,
		      const struct rpc_call_ops *, int, int);
		      const struct rpc_call_ops *call_ops, int how, int flags);
void nfs_free_request(struct nfs_page *req);
void nfs_free_request(struct nfs_page *req);


static inline void nfs_iocounter_init(struct nfs_io_counter *c)
static inline void nfs_iocounter_init(struct nfs_io_counter *c)
+5 −3
Original line number Original line Diff line number Diff line
@@ -597,14 +597,14 @@ static void nfs_pgio_prepare(struct rpc_task *task, void *calldata)
}
}


int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr,
		      const struct nfs_rpc_ops *rpc_ops,
		      struct rpc_cred *cred, const struct nfs_rpc_ops *rpc_ops,
		      const struct rpc_call_ops *call_ops, int how, int flags)
		      const struct rpc_call_ops *call_ops, int how, int flags)
{
{
	struct rpc_task *task;
	struct rpc_task *task;
	struct rpc_message msg = {
	struct rpc_message msg = {
		.rpc_argp = &hdr->args,
		.rpc_argp = &hdr->args,
		.rpc_resp = &hdr->res,
		.rpc_resp = &hdr->res,
		.rpc_cred = hdr->cred,
		.rpc_cred = cred,
	};
	};
	struct rpc_task_setup task_setup_data = {
	struct rpc_task_setup task_setup_data = {
		.rpc_client = clnt,
		.rpc_client = clnt,
@@ -793,7 +793,9 @@ static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc)
	ret = nfs_generic_pgio(desc, hdr);
	ret = nfs_generic_pgio(desc, hdr);
	if (ret == 0)
	if (ret == 0)
		ret = nfs_initiate_pgio(NFS_CLIENT(hdr->inode),
		ret = nfs_initiate_pgio(NFS_CLIENT(hdr->inode),
					hdr, NFS_PROTO(hdr->inode),
					hdr,
					hdr->cred,
					NFS_PROTO(hdr->inode),
					desc->pg_rpc_callops,
					desc->pg_rpc_callops,
					desc->pg_ioflags, 0);
					desc->pg_ioflags, 0);
	return ret;
	return ret;