]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
NFS: Cleanup - add nfs_clients_exit to mirror nfs_clients_init
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 6 Feb 2019 14:32:50 +0000 (09:32 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 6 Jul 2019 18:54:49 +0000 (14:54 -0400)
Add a helper to clean up the struct nfs_net when it is being destroyed.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/client.c
fs/nfs/inode.c
fs/nfs/internal.h

index d7e4f0848e28c77371769d9a4a45165e3770705e..0acb104f7b00c190f90129882e9c3338ba305339 100644 (file)
@@ -192,7 +192,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);
 
@@ -214,7 +214,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)
 {
 }
 
@@ -1074,6 +1074,15 @@ void nfs_clients_init(struct net *net)
        nn->boot_time = ktime_get_real();
 }
 
+void nfs_clients_exit(struct net *net)
+{
+       struct nfs_net *nn = net_generic(net, nfs_net_id);
+
+       nfs_cleanup_cb_ident_idr(net);
+       WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
+       WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
+}
+
 #ifdef CONFIG_PROC_FS
 static void *nfs_server_list_start(struct seq_file *p, loff_t *pos);
 static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos);
index 8dba56491de2972eaad35c6da42317b7b1cc27e9..f4944ef306a8459af7e63338247228b4bc62dca6 100644 (file)
@@ -2161,12 +2161,8 @@ static int nfs_net_init(struct net *net)
 
 static void nfs_net_exit(struct net *net)
 {
-       struct nfs_net *nn = net_generic(net, nfs_net_id);
-
        nfs_fs_proc_net_exit(net);
-       nfs_cleanup_cb_ident_idr(net);
-       WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
-       WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
+       nfs_clients_exit(net);
 }
 
 static struct pernet_operations nfs_net_ops = {
index 498fab72f70bc8b4d3033126bbe1eaa2635e6db1..9e87265907b8a25ddc77081a5298b23fc498ce52 100644 (file)
@@ -158,6 +158,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 *);
@@ -170,7 +171,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);