[PATCH v7 1/3] SUNRPC: export nfsd4_op_name utility routine

Lorenzo Bianconi
2023-08-30T18:29:47Z

This is a preliminary patch to introduce nfsd_rpc_status netlink info
in order to dump pending RPC requests debugging information.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
fs/nfsd/nfs4proc.c | 4 +---
fs/nfsd/nfsd.h | 6 ++++++
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 5ca748309c26..074bac13c383 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -2485,8 +2485,6 @@ static inline void nfsd4_increment_op_stats(u32 opnum)

static const struct nfsd4_operation nfsd4_ops[];

-static const char *nfsd4_op_name(unsigned opnum);
-
/*
* Enforce NFSv4.1 COMPOUND ordering rules:
*
@@ -3616,7 +3614,7 @@ void warn_on_nonidempotent_op(struct nfsd4_op *op)
}
}

-static const char *nfsd4_op_name(unsigned opnum)
+const char *nfsd4_op_name(unsigned int opnum)
{
if (opnum < ARRAY_SIZE(nfsd4_ops))
return nfsd4_ops[opnum].op_name;
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 11c14faa6c67..e95c3322eb9b 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -511,12 +511,18 @@ extern void nfsd4_ssc_init_umount_work(struct nfsd_net *nn);

extern void nfsd4_init_leases_net(struct nfsd_net *nn);

+const char *nfsd4_op_name(unsigned int opnum);
#else /* CONFIG_NFSD_V4 */
static inline int nfsd4_is_junction(struct dentry *dentry)
{
return 0;
}

+static inline const char *nfsd4_op_name(unsigned int opnum)
+{
+ return "unknown_operation";
+}
+
static inline void nfsd4_init_leases_net(struct nfsd_net *nn) { };

#define register_cld_notifier() 0
--
2.41.0