NFS: add a sysfs link to the lockd rpc_client
authorBenjamin Coddington <bcodding@redhat.com>
Thu, 15 Jun 2023 18:07:28 +0000 (14:07 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 19 Jun 2023 19:06:07 +0000 (15:06 -0400)
After lockd is started, add a symlink for lockd's rpc_client under
NFS' superblock sysfs.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/lockd/clntlock.c
fs/nfs/client.c
include/linux/lockd/bind.h

index e3972aa3045a38e5d9b30666dee0b7d1c2718eef..5d85715be763044ad2245815295567bcfb84c2d4 100644 (file)
@@ -93,6 +93,12 @@ void nlmclnt_prepare_block(struct nlm_wait *block, struct nlm_host *host, struct
        block->b_status = nlm_lck_blocked;
 }
 
+struct rpc_clnt *nlmclnt_rpc_clnt(struct nlm_host *host)
+{
+       return host->h_rpcclnt;
+}
+EXPORT_SYMBOL_GPL(nlmclnt_rpc_clnt);
+
 /*
  * Queue up a lock for blocking so that the GRANTED request can see it
  */
index 745c661429f216fc22578e790103252de28e4797..48c9d8411c0e61d92dd738235346bd396f6d971c 100644 (file)
@@ -599,6 +599,7 @@ static int nfs_start_lockd(struct nfs_server *server)
 
        server->nlm_host = host;
        server->destroy = nfs_destroy_server;
+       nfs_sysfs_link_rpc_client(server, nlmclnt_rpc_clnt(host), NULL);
        return 0;
 }
 
index 3bc9f7410e2138a9b71396ac95f410124c81631c..c53c81242e72716f17f580c17b3694b3aff8c8f5 100644 (file)
@@ -20,6 +20,7 @@
 /* Dummy declarations */
 struct svc_rqst;
 struct rpc_task;
+struct rpc_clnt;
 
 /*
  * This is the set of functions for lockd->nfsd communication
@@ -56,6 +57,7 @@ struct nlmclnt_initdata {
 
 extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
 extern void    nlmclnt_done(struct nlm_host *host);
+extern struct rpc_clnt *nlmclnt_rpc_clnt(struct nlm_host *host);
 
 /*
  * NLM client operations provide a means to modify RPC processing of NLM