Commit b32d2b13 authored by Josef Bacik's avatar Josef Bacik Committed by Wang Zhaolong
Browse files

sunrpc: add a struct rpc_stats arg to rpc_create_args

stable inclusion
from stable-v5.10.217
commit 95ebd5fc15b7522a03b95f42148278bfbfb7dc03
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9W3QR
CVE: CVE-2024-36939

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=95ebd5fc15b7522a03b95f42148278bfbfb7dc03



--------------------------------

[ Upstream commit 2057a48d0dd00c6a2a94ded7df2bf1d3f2a4a0da ]

We want to be able to have our rpc stats handled in a per network
namespace manner, so add an option to rpc_create_args to specify a
different rpc_stats struct instead of using the one on the rpc_program.

Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Stable-dep-of: 24457f1be29f ("nfs: Handle error of rpc_proc_register() in nfs_net_init().")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWang Zhaolong <wangzhaolong1@huawei.com>
parent 9bb937dc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ struct rpc_create_args {
	const char		*servername;
	const char		*nodename;
	const struct rpc_program *program;
	struct rpc_stat		*stats;
	u32			prognumber;	/* overrides program->number */
	u32			version;
	rpc_authflavor_t	authflavor;
+4 −1
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
	clnt->cl_maxproc  = version->nrprocs;
	clnt->cl_prog     = args->prognumber ? : program->number;
	clnt->cl_vers     = version->number;
	clnt->cl_stats    = program->stats;
	clnt->cl_stats    = args->stats ? : program->stats;
	clnt->cl_metrics  = rpc_alloc_iostats(clnt);
	rpc_init_pipe_dir_head(&clnt->cl_pipedir_objects);
	err = -ENOMEM;
@@ -672,6 +672,7 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *clnt)
		.version	= clnt->cl_vers,
		.authflavor	= clnt->cl_auth->au_flavor,
		.cred		= clnt->cl_cred,
		.stats		= clnt->cl_stats,
	};
	return __rpc_clone_client(&args, clnt);
}
@@ -694,6 +695,7 @@ rpc_clone_client_set_auth(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
		.version	= clnt->cl_vers,
		.authflavor	= flavor,
		.cred		= clnt->cl_cred,
		.stats		= clnt->cl_stats,
	};
	return __rpc_clone_client(&args, clnt);
}
@@ -974,6 +976,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
		.version	= vers,
		.authflavor	= old->cl_auth->au_flavor,
		.cred		= old->cl_cred,
		.stats		= old->cl_stats,
	};
	struct rpc_clnt *clnt;
	int err;