]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sunrpc: add a struct rpc_stats arg to rpc_create_args
authorJosef Bacik <josef@toxicpanda.com>
Thu, 15 Feb 2024 19:57:30 +0000 (14:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:01:57 +0000 (12:01 +0200)
[ 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: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Stable-dep-of: 24457f1be29f ("nfs: Handle error of rpc_proc_register() in nfs_net_init().")
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/sunrpc/clnt.h
net/sunrpc/clnt.c

index e9d4377d03c6e78f07a8688bb0bd6a53e2bb8fe8..17d84b3ee8a018aa71e92b2ca379b6701d01ccbf 100644 (file)
@@ -139,6 +139,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;
index 339dfc5b92246a161a1cba7214489fdc4004c990..f4d32cf2cd16af60328dc6234da1279127465e40 100644 (file)
@@ -399,7 +399,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;
@@ -685,6 +685,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);
 }
@@ -707,6 +708,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);
 }
@@ -1053,6 +1055,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;