[Devel] [PATCH RHEL7 COMMIT] ms/NFS: Cleanup - add nfs_clients_exit to mirror nfs_clients_init

Vasily Averin vvs at virtuozzo.com
Tue Jan 25 12:38:08 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.53.1.vz7.185.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.53.1.vz7.185.2
------>
commit 9a7d1aad5bb15ccad26807c81a217d071d6ab645
Author: Trond Myklebust <trond.myklebust at hammerspace.com>
Date:   Tue Jan 25 12:38:08 2022 +0300

    ms/NFS: Cleanup - add nfs_clients_exit to mirror nfs_clients_init
    
    Add a helper to clean up the struct nfs_net when it is being destroyed.
    
    Signed-off-by: Trond Myklebust <trond.myklebust at hammerspace.com>
    
    (cherry-picked from ms commit 10b7a70cbb81a62353f763c3343ac0c48410696f)
    https://jira.sw.ru/browse/PSBM-137154
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 fs/nfs/client.c   | 11 +++++++++--
 fs/nfs/inode.c    |  2 +-
 fs/nfs/internal.h |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 271acc4..485f362 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -199,7 +199,7 @@ error_0:
 EXPORT_SYMBOL_GPL(nfs_alloc_client);
 
 #if IS_ENABLED(CONFIG_NFS_V4)
-void nfs_cleanup_cb_ident_idr(struct net *net)
+static void nfs_cleanup_cb_ident_idr(struct net *net)
 {
 	struct nfs_net *nn = net_generic(net, nfs_net_id);
 
@@ -221,7 +221,7 @@ static void pnfs_init_server(struct nfs_server *server)
 }
 
 #else
-void nfs_cleanup_cb_ident_idr(struct net *net)
+static void nfs_cleanup_cb_ident_idr(struct net *net)
 {
 }
 
@@ -1131,6 +1131,13 @@ void nfs_clients_init(struct net *net)
 	nn->boot_time = CURRENT_TIME;
 }
 
+void nfs_clients_exit(struct net *net)
+{
+	struct nfs_net *nn = net_generic(net, nfs_net_id);
+
+	nfs_cleanup_cb_ident_idr(net);
+}
+
 #ifdef CONFIG_PROC_FS
 static int nfs_server_list_open(struct inode *inode, struct file *file);
 static void *nfs_server_list_start(struct seq_file *p, loff_t *pos);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index b7b5e7f..8f666da 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2047,7 +2047,7 @@ static int nfs_net_init(struct net *net)
 static void nfs_net_exit(struct net *net)
 {
 	nfs_fs_proc_net_exit(net);
-	nfs_cleanup_cb_ident_idr(net);
+	nfs_clients_exit(net);
 }
 
 static struct pernet_operations nfs_net_ops = {
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 5cd2038..65a9e19 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -152,6 +152,7 @@ extern void nfs_umount(const struct nfs_mount_request *info);
 /* client.c */
 extern const struct rpc_program nfs_program;
 extern void nfs_clients_init(struct net *net);
+extern void nfs_clients_exit(struct net *net);
 extern struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *);
 int nfs_create_rpc_client(struct nfs_client *, const struct nfs_client_initdata *, rpc_authflavor_t);
 struct nfs_client *nfs_get_client(const struct nfs_client_initdata *,
@@ -165,7 +166,6 @@ int nfs_init_server_rpcclient(struct nfs_server *, const struct rpc_timeout *t,
 struct nfs_server *nfs_alloc_server(void);
 void nfs_server_copy_userdata(struct nfs_server *, struct nfs_server *);
 
-extern void nfs_cleanup_cb_ident_idr(struct net *);
 extern void nfs_put_client(struct nfs_client *);
 extern void nfs_free_client(struct nfs_client *);
 extern struct nfs_client *nfs4_find_client_ident(struct net *, int);


More information about the Devel mailing list