diff options
author | Benjamin Coddington <bcodding@redhat.com> | 2023-06-15 14:07:27 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2023-06-19 15:04:13 -0400 |
commit | e13b549319a684dd80c4cc25e9567a5c84007e32 (patch) | |
tree | cf0f8538359cc734dfd594d8a6c32db8f832c69d /fs/nfs/sysfs.c | |
parent | 1c7251187dc067a6d460cf33ca67da9c1dd87807 (diff) |
NFS: Add sysfs links to sunrpc clients for nfs_clients
For the general and state management nfs_client under each mount, create
symlinks to their respective rpc_client sysfs entries.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/sysfs.c')
-rw-r--r-- | fs/nfs/sysfs.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c index 0ff24f133a02..7009de149158 100644 --- a/fs/nfs/sysfs.c +++ b/fs/nfs/sysfs.c @@ -216,6 +216,26 @@ void nfs_netns_sysfs_destroy(struct nfs_net *netns) } } +#define RPC_CLIENT_NAME_SIZE 64 + +void nfs_sysfs_link_rpc_client(struct nfs_server *server, + struct rpc_clnt *clnt, const char *uniq) +{ + char name[RPC_CLIENT_NAME_SIZE]; + int ret; + + strcpy(name, clnt->cl_program->name); + strcat(name, uniq ? uniq : ""); + strcat(name, "_client"); + + ret = sysfs_create_link_nowarn(&server->kobj, + &clnt->cl_sysfs->kobject, name); + if (ret < 0) + pr_warn("NFS: can't create link to %s in sysfs (%d)\n", + name, ret); +} +EXPORT_SYMBOL_GPL(nfs_sysfs_link_rpc_client); + static void nfs_sysfs_sb_release(struct kobject *kobj) { /* no-op: why? see lib/kobject.c kobject_cleanup() */ |