]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/nfs/cache_lib.c
Merge branch 'xfs-4.9-log-recovery-fixes' into for-next
[mirror_ubuntu-bionic-kernel.git] / fs / nfs / cache_lib.c
index 862a2f16db64b7335453ef88ed7bea6e153cfa91..5f7b053720eed9741250193784f0c33ac378df69 100644 (file)
@@ -128,10 +128,13 @@ int nfs_cache_register_net(struct net *net, struct cache_detail *cd)
        struct super_block *pipefs_sb;
        int ret = 0;
 
+       sunrpc_init_cache_detail(cd);
        pipefs_sb = rpc_get_sb_net(net);
        if (pipefs_sb) {
                ret = nfs_cache_register_sb(pipefs_sb, cd);
                rpc_put_sb_net(net);
+               if (ret)
+                       sunrpc_destroy_cache_detail(cd);
        }
        return ret;
 }
@@ -151,14 +154,5 @@ void nfs_cache_unregister_net(struct net *net, struct cache_detail *cd)
                nfs_cache_unregister_sb(pipefs_sb, cd);
                rpc_put_sb_net(net);
        }
-}
-
-void nfs_cache_init(struct cache_detail *cd)
-{
-       sunrpc_init_cache_detail(cd);
-}
-
-void nfs_cache_destroy(struct cache_detail *cd)
-{
        sunrpc_destroy_cache_detail(cd);
 }