summaryrefslogtreecommitdiff
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-02-06 17:32:50 +0300
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-06 21:54:49 +0300
commit10b7a70cbb81a62353f763c3343ac0c48410696f (patch)
treec8be11f391439f6b72645add073f4a3763a5ea92 /fs/nfs/client.c
parent996bc4f405d37ffd88c9b830202ee47fc7a6c449 (diff)
downloadlinux-10b7a70cbb81a62353f763c3343ac0c48410696f.tar.xz
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@hammerspace.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index d7e4f0848e28..0acb104f7b00 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -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);