^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* AFS client file system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2002,5 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/moduleparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/completion.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/random.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define CREATE_TRACE_POINTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) MODULE_DESCRIPTION("AFS Client File System");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) MODULE_AUTHOR("Red Hat, Inc.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) unsigned afs_debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) module_param_named(debug, afs_debug, uint, S_IWUSR | S_IRUGO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) MODULE_PARM_DESC(debug, "AFS debugging mask");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static char *rootcell;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) module_param(rootcell, charp, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct workqueue_struct *afs_wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static struct proc_dir_entry *afs_proc_symlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #if defined(CONFIG_ALPHA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) const char afs_init_sysname[] = "alpha_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #elif defined(CONFIG_X86_64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) const char afs_init_sysname[] = "amd64_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #elif defined(CONFIG_ARM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) const char afs_init_sysname[] = "arm_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #elif defined(CONFIG_ARM64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) const char afs_init_sysname[] = "aarch64_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #elif defined(CONFIG_X86_32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) const char afs_init_sysname[] = "i386_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #elif defined(CONFIG_IA64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) const char afs_init_sysname[] = "ia64_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #elif defined(CONFIG_PPC64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) const char afs_init_sysname[] = "ppc64_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #elif defined(CONFIG_PPC32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) const char afs_init_sysname[] = "ppc_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #elif defined(CONFIG_S390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #ifdef CONFIG_64BIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) const char afs_init_sysname[] = "s390x_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) const char afs_init_sysname[] = "s390_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #elif defined(CONFIG_SPARC64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) const char afs_init_sysname[] = "sparc64_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #elif defined(CONFIG_SPARC32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) const char afs_init_sysname[] = "sparc_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) const char afs_init_sysname[] = "unknown_linux26";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * Initialise an AFS network namespace record.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static int __net_init afs_net_init(struct net *net_ns)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct afs_sysnames *sysnames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) struct afs_net *net = afs_net(net_ns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) net->net = net_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) net->live = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) generate_random_uuid((unsigned char *)&net->uuid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) INIT_WORK(&net->charge_preallocation_work, afs_charge_preallocation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) mutex_init(&net->socket_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) net->cells = RB_ROOT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) init_rwsem(&net->cells_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) INIT_WORK(&net->cells_manager, afs_manage_cells);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) timer_setup(&net->cells_timer, afs_cells_timer, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) mutex_init(&net->cells_alias_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) mutex_init(&net->proc_cells_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) INIT_HLIST_HEAD(&net->proc_cells);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) seqlock_init(&net->fs_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) net->fs_servers = RB_ROOT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) INIT_LIST_HEAD(&net->fs_probe_fast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) INIT_LIST_HEAD(&net->fs_probe_slow);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) INIT_HLIST_HEAD(&net->fs_proc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) INIT_HLIST_HEAD(&net->fs_addresses4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) INIT_HLIST_HEAD(&net->fs_addresses6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) seqlock_init(&net->fs_addr_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) INIT_WORK(&net->fs_manager, afs_manage_servers);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) timer_setup(&net->fs_timer, afs_servers_timer, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) INIT_WORK(&net->fs_prober, afs_fs_probe_dispatcher);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) timer_setup(&net->fs_probe_timer, afs_fs_probe_timer, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) atomic_set(&net->servers_outstanding, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) sysnames = kzalloc(sizeof(*sysnames), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) if (!sysnames)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) goto error_sysnames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) sysnames->subs[0] = (char *)&afs_init_sysname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) sysnames->nr = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) refcount_set(&sysnames->usage, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) net->sysnames = sysnames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) rwlock_init(&net->sysnames_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* Register the /proc stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ret = afs_proc_init(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) goto error_proc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /* Initialise the cell DB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ret = afs_cell_init(net, rootcell);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) goto error_cell_init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /* Create the RxRPC transport */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) ret = afs_open_socket(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) goto error_open_socket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) error_open_socket:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) net->live = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) afs_fs_probe_cleanup(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) afs_cell_purge(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) afs_purge_servers(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) error_cell_init:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) net->live = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) afs_proc_cleanup(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) error_proc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) afs_put_sysnames(net->sysnames);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) error_sysnames:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) net->live = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * Clean up and destroy an AFS network namespace record.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static void __net_exit afs_net_exit(struct net *net_ns)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct afs_net *net = afs_net(net_ns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) net->live = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) afs_fs_probe_cleanup(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) afs_cell_purge(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) afs_purge_servers(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) afs_close_socket(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) afs_proc_cleanup(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) afs_put_sysnames(net->sysnames);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static struct pernet_operations afs_net_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .init = afs_net_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) .exit = afs_net_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .id = &afs_net_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) .size = sizeof(struct afs_net),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * initialise the AFS client FS module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static int __init afs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) afs_wq = alloc_workqueue("afs", 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) if (!afs_wq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) goto error_afs_wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) afs_async_calls = alloc_workqueue("kafsd", WQ_MEM_RECLAIM, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (!afs_async_calls)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) goto error_async;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) afs_lock_manager = alloc_workqueue("kafs_lockd", WQ_MEM_RECLAIM, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) if (!afs_lock_manager)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) goto error_lockmgr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #ifdef CONFIG_AFS_FSCACHE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /* we want to be able to cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ret = fscache_register_netfs(&afs_cache_netfs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) goto error_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) ret = register_pernet_device(&afs_net_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) goto error_net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) /* register the filesystems */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) ret = afs_fs_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) goto error_fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) afs_proc_symlink = proc_symlink("fs/afs", NULL, "../self/net/afs");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if (!afs_proc_symlink) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) goto error_proc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) error_proc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) afs_fs_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) error_fs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) unregister_pernet_device(&afs_net_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) error_net:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) #ifdef CONFIG_AFS_FSCACHE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) fscache_unregister_netfs(&afs_cache_netfs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) error_cache:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) destroy_workqueue(afs_lock_manager);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) error_lockmgr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) destroy_workqueue(afs_async_calls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) error_async:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) destroy_workqueue(afs_wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) error_afs_wq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) rcu_barrier();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /* XXX late_initcall is kludgy, but the only alternative seems to create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * a transport upon the first mount, which is worse. Or is it?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) late_initcall(afs_init); /* must be called after net/ to create socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * clean up on module removal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) static void __exit afs_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 unregistering.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) proc_remove(afs_proc_symlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) afs_fs_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) unregister_pernet_device(&afs_net_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) #ifdef CONFIG_AFS_FSCACHE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) fscache_unregister_netfs(&afs_cache_netfs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) destroy_workqueue(afs_lock_manager);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) destroy_workqueue(afs_async_calls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) destroy_workqueue(afs_wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) afs_clean_up_permit_cache();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) rcu_barrier();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) module_exit(afs_exit);