diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 773389ef15651fcb91dcb26732a82f7a05d9aa59..37c970407d37106e832732d0b6bbdb6d876dd201 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -7266,7 +7266,7 @@ CONFIG_NFS_ACL_SUPPORT=m CONFIG_NFS_COMMON=y CONFIG_NFS_V4_2_SSC_HELPER=y CONFIG_ENFS=m -CONFIG_SUNRPC_ENFS=m +CONFIG_SUNRPC_ENFS=y CONFIG_SUNRPC=m CONFIG_SUNRPC_GSS=m CONFIG_SUNRPC_BACKCHANNEL=y diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index 52e6ccad8aa8e9b8b2338bbe0e87b326f52268e4..d00c4dd20b0f8a82c22b7985d7fce6d6a54ac7c1 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -8455,7 +8455,7 @@ CONFIG_NFS_ACL_SUPPORT=m CONFIG_NFS_COMMON=y CONFIG_NFS_V4_2_SSC_HELPER=y CONFIG_ENFS=m -CONFIG_SUNRPC_ENFS=m +CONFIG_SUNRPC_ENFS=y CONFIG_SUNRPC=m CONFIG_SUNRPC_GSS=m CONFIG_SUNRPC_BACKCHANNEL=y diff --git a/fs/nfs/enfs/enfs_init.c b/fs/nfs/enfs/enfs_init.c index 6f4ddd5655416bf8094540c3034488b0fc8332f2..7ce4a117e8163e821d52f3ce309bc1b28a5e686a 100644 --- a/fs/nfs/enfs/enfs_init.c +++ b/fs/nfs/enfs/enfs_init.c @@ -88,16 +88,6 @@ static struct enfs_init_entry init_entry[] = { { "dns", enfs_dns_init, enfs_dns_exit }, }; -int32_t enfs_init(void) -{ - return init_helper_init(init_entry, ARRAY_SIZE(init_entry)); -} - -void enfs_fini(void) -{ - init_helper_finalize(init_entry, ARRAY_SIZE(init_entry)); -} - static int __init init_enfs(void) { int ret; @@ -108,7 +98,7 @@ static int __init init_enfs(void) return -1; } - ret = enfs_init(); + ret = init_helper_init(init_entry, ARRAY_SIZE(init_entry)); if (ret) { enfs_adapter_unregister(&enfs_adapter); return -1; @@ -126,7 +116,7 @@ static int __init init_enfs(void) static void __exit exit_enfs(void) { enfs_lookupcache_fini(); - enfs_fini(); + init_helper_finalize(init_entry, ARRAY_SIZE(init_entry)); enfs_adapter_unregister(&enfs_adapter); } diff --git a/fs/nfs/enfs/enfs_multipath.c b/fs/nfs/enfs/enfs_multipath.c index 297b4737647c94fcbf0e074b77a449934a981807..fd7990b5474252eff34bb292ff51ea3c171ccf21 100644 --- a/fs/nfs/enfs/enfs_multipath.c +++ b/fs/nfs/enfs/enfs_multipath.c @@ -669,13 +669,6 @@ struct xprts_options_and_clnt { void *data; }; -static void set_clnt_enfs_flag(struct rpc_clnt *clnt) -{ - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - - clnt_reserve->cl_enfs = 1; -} - int enfs_config_xprt_create_args(struct xprt_create *xprtargs, struct rpc_create_args *args, char *servername, size_t length) @@ -882,7 +875,7 @@ int enfs_multipath_create_thread(void *data) if (errno != 0) enfs_log_error("create clnt proc failed.\n"); - set_clnt_enfs_flag(create_args->clnt); + create_args->clnt->cl_enfs = 1; enfs_xprt_ippair_create(&xprtargs, create_args->clnt, mount_options); kfree(create_args->args); diff --git a/fs/nfs/enfs/enfs_multipath_client.c b/fs/nfs/enfs/enfs_multipath_client.c index 916e065622af5cb38a097e24b7c9b2ada4b13128..4d5eb61dc1fa74521651e67a84d6a3ed5fc93e19 100644 --- a/fs/nfs/enfs/enfs_multipath_client.c +++ b/fs/nfs/enfs/enfs_multipath_client.c @@ -69,7 +69,8 @@ void enfs_free_nfsclient_info(struct multipath_client_info *client_info) kfree(client_info); } -int nfs_multipath_client_mount_info_init( +static int +nfs_multipath_client_mount_info_init( struct multipath_client_info *client_info, const struct nfs_client_initdata *cl_init) { @@ -170,8 +171,10 @@ int nfs_multipath_client_info_init(void **data, return rc; } -bool nfs_multipath_ip_list_info_match(const struct nfs_ip_list *ip_list_src, - const struct nfs_ip_list *ip_list_dst) +static bool +nfs_multipath_ip_list_info_match( + const struct nfs_ip_list *ip_list_src, + const struct nfs_ip_list *ip_list_dst) { int i; int j; @@ -307,40 +310,54 @@ int nfs4_multipath_client_info_match(void *src, void *dst) return ret; } -void print_ip_info(struct seq_file *mount_option, struct nfs_ip_list *ip_list, - const char *type) +static void +print_ip_info( + struct seq_file *seq, + struct nfs_ip_list *ip_list, + const char *type) { char buf[IP_ADDRESS_LEN_MAX + 1]; int len = 0; int i = 0; - seq_printf(mount_option, ",%s=", type); + if (seq) + seq_printf(seq, ",%s=", type); + enfs_log_debug("%s ip list:\n", type); + for (i = 0; i < ip_list->count; i++) { len = rpc_ntop((struct sockaddr *)&ip_list->address[i], buf, IP_ADDRESS_LEN_MAX); if (len > 0 && len < IP_ADDRESS_LEN_MAX) buf[len] = '\0'; - if (i == 0) - seq_printf(mount_option, "%s", buf); - else - seq_printf(mount_option, "~%s", buf); - enfs_log_debug("show nfs mount option type:%s %s\n", type, buf); + if (i != 0 && seq) + seq_printf(seq, "~"); + if (seq) + seq_printf(seq, "%s", buf); + + enfs_log_debug("\t%s\n", buf); } } -void print_dns_info(struct seq_file *seq, struct enfs_route_dns_info *pRemoteDnsInfo, - const char *type) +static void +print_dns_info( + struct seq_file *seq, + struct enfs_route_dns_info *pRemoteDnsInfo, + const char *type) { int i = 0; char *name; - seq_printf(seq, ",%s=", type); + if (seq) + seq_printf(seq, ",%s=", type); + enfs_log_debug("%s dns list:\n", type); for (i = 0; i < pRemoteDnsInfo->dnsNameCount; i++) { name = pRemoteDnsInfo->routeRemoteDnsList[i].dnsname; - if (i == 0) + if (i != 0 && seq) + seq_printf(seq, "~"); + if (seq) seq_printf(seq, "%s", name); - seq_printf(seq, "~%s", name); + enfs_log_debug("\t%s\n", name); } } @@ -366,8 +383,11 @@ static void multipath_print_sockaddr(struct seq_file *seq, enfs_log_error("unsupport family:%d\n", addr->sa_family); } -void convert_lookup_cache_str(struct nfs_server *server, char **server_lookup, - char **actual_lookup) +static void +convert_lookup_cache_str( + struct nfs_server *server, + char **server_lookup, + char **actual_lookup) { if ((server->enfs_flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) && (server->enfs_flags & NFS_MOUNT_LOOKUP_CACHE_NONE)) { diff --git a/fs/nfs/enfs/enfs_proc.c b/fs/nfs/enfs/enfs_proc.c index 1b15102bdd643bba83ceb04e7c05a72f86dfa15a..ba3d19d1e58c81092fd618fa65185e4cad7a9620 100644 --- a/fs/nfs/enfs/enfs_proc.c +++ b/fs/nfs/enfs/enfs_proc.c @@ -97,10 +97,8 @@ static int debug_show_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt, static int debug_show_clnt(struct rpc_clnt *clnt, void *data) { - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - enfs_log_info("clnt %d addr:%p enfs:%d\n", clnt->cl_clid, clnt, - clnt_reserve->cl_enfs); + clnt->cl_enfs); rpc_clnt_iterate_for_each_xprt(clnt, debug_show_xprt, NULL); return 0; } @@ -504,9 +502,7 @@ int enfs_proc_create_clnt(struct rpc_clnt *clnt) void enfs_proc_delete_clnt(struct rpc_clnt *clnt) { - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - - if (clnt_reserve->cl_enfs == 1) { + if (clnt->cl_enfs == 1) { enfs_proc_delete_file(clnt); enfs_clnt_release_linkcap(clnt); } @@ -598,9 +594,7 @@ static void enfs_proc_delete_parent(void) static int enfs_proc_init_create_clnt(struct rpc_clnt *clnt, void *data) { - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - - if (clnt_reserve->cl_enfs == 1) { + if (clnt->cl_enfs == 1) { enfs_proc_create_file(clnt); enfs_clnt_get_linkcap(clnt); } @@ -609,9 +603,7 @@ static int enfs_proc_init_create_clnt(struct rpc_clnt *clnt, void *data) static int enfs_proc_destroy_clnt(struct rpc_clnt *clnt, void *data) { - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - - if (clnt_reserve->cl_enfs == 1) + if (clnt->cl_enfs == 1) enfs_proc_delete_file(clnt); return 0; } diff --git a/fs/nfs/enfs/enfs_roundrobin.c b/fs/nfs/enfs/enfs_roundrobin.c index 45ad65c52120eb7ed56d1917ede10a78aacdaaa6..8129c461e24dc613ec983775dc2d6087a42ec700 100644 --- a/fs/nfs/enfs/enfs_roundrobin.c +++ b/fs/nfs/enfs/enfs_roundrobin.c @@ -263,9 +263,7 @@ static struct rpc_xprt *enfs_lb_iter_current_entry(struct rpc_xprt_iter *xpi) int enfs_lb_set_policy(struct rpc_clnt *clnt, void *data) { - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - - if (clnt_reserve->cl_enfs == 1) + if (clnt->cl_enfs == 1) enfs_lb_switch_set_roundrobin(clnt); return 0; @@ -332,9 +330,8 @@ bool enfs_is_singularr_route(struct rpc_clnt *clnt) int enfs_lb_revert_policy(struct rpc_clnt *clnt, void *data) { struct rpc_xprt_switch *xps; - struct rpc_clnt_reserve *clnt_reserve = (struct rpc_clnt_reserve *)clnt; - if (clnt_reserve->cl_enfs == 1) { + if (clnt->cl_enfs == 1) { rcu_read_lock(); xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch); rcu_read_unlock(); diff --git a/fs/nfs/enfs/failover_com.h b/fs/nfs/enfs/failover_com.h index bcf29a6d54bed216e1015954527934e33857d444..691be28f0d2cf1af57e16326d2827e44cde66e6d 100644 --- a/fs/nfs/enfs/failover_com.h +++ b/fs/nfs/enfs/failover_com.h @@ -9,19 +9,17 @@ static inline bool failover_is_enfs_clnt(struct rpc_clnt *clnt) { struct rpc_clnt *next = clnt->cl_parent; - struct rpc_clnt_reserve *clnt_reserve; + struct rpc_clnt *target = clnt; while (next) { if (next == next->cl_parent) break; next = next->cl_parent; } - if (next != NULL) { - clnt_reserve = (struct rpc_clnt_reserve *)next; - return clnt_reserve->cl_enfs == 1 ? true : false; - } - clnt_reserve = (struct rpc_clnt_reserve *)clnt; - return clnt_reserve->cl_enfs == 1 ? true : false; + + if (next != NULL) + target = next; + return target->cl_enfs == 1 ? true : false; } #endif // FAILOVER_COMMON_H diff --git a/fs/nfs/enfs/failover_path.c b/fs/nfs/enfs/failover_path.c index 8e4dd8a7416aefc9521bdde9092e3d80f9452b8a..59b40bd735975b26ede73b7f903b6ade9cd7b251 100644 --- a/fs/nfs/enfs/failover_path.c +++ b/fs/nfs/enfs/failover_path.c @@ -251,7 +251,6 @@ void failover_reselect_transport(struct rpc_task *task, struct rpc_clnt *clnt) struct rpc_xprt *old; struct rpc_xprt *parent_cursor; struct rpc_clnt *parent_clnt = clnt; - struct rpc_clnt_reserve *clnt_reserve; if (task->tk_xprt && !failover_prepare_transmit(task)) { reselect_xprt(task); @@ -264,9 +263,8 @@ void failover_reselect_transport(struct rpc_task *task, struct rpc_clnt *clnt) parent_clnt = parent_clnt->cl_parent; } while (parent_clnt); - clnt_reserve = (struct rpc_clnt_reserve *)parent_clnt; - if (task->tk_xprt && clnt->cl_vers == 4 && clnt_reserve && - clnt_reserve->cl_enfs) { + if (task->tk_xprt && clnt->cl_vers == 4 && parent_clnt && + parent_clnt->cl_enfs) { old = smp_load_acquire(cursor); // multi thread to access parent_cursor = xprt_iter_get_xprt(&parent_clnt->cl_xpi); if (parent_cursor != old) diff --git a/fs/nfs/enfs/pm_ping.c b/fs/nfs/enfs/pm_ping.c index aa0514768aee7659e278c7a2b26dd2a1548637bc..934ec656b5b818cf9f7e4b8251fa7da649ce9fab 100644 --- a/fs/nfs/enfs/pm_ping.c +++ b/fs/nfs/enfs/pm_ping.c @@ -294,13 +294,11 @@ static int pm_ping_execute_xprt_test(struct rpc_clnt *clnt, static void pm_ping_loop_rpclnt(struct sunrpc_net *sn) { struct rpc_clnt *clnt; - struct rpc_clnt_reserve *clnt_reserve; LIST_HEAD(free_list); spin_lock(&sn->rpc_client_lock); list_for_each_entry_rcu(clnt, &sn->all_clients, cl_clients) { - clnt_reserve = (struct rpc_clnt_reserve *)clnt; - if (clnt_reserve->cl_enfs == 1) { + if (clnt->cl_enfs == 1) { enfs_log_debug("find rpc_clnt. %p\n", clnt); rpc_clnt_iterate_for_each_xprt(clnt, pm_ping_execute_xprt_test, (void *)&free_list); diff --git a/fs/nfs/enfs/shard_route.c b/fs/nfs/enfs/shard_route.c index 94de3886e9bc216f20e7222843a40ca99712eda3..9a55fbd15f2c1ef8431f1c8ba9dcb002419ea7f6 100644 --- a/fs/nfs/enfs/shard_route.c +++ b/fs/nfs/enfs/shard_route.c @@ -114,37 +114,40 @@ static bool delete_view_table(uint64_t devId); static int enfs_find_clnt_root(struct rpc_clnt *clnt, struct enfs_file_uuid *root_uuid) { + int ret = 0; struct clnt_uuid_info *info; read_lock(&shard_ctrl->clnt_info_lock); list_for_each_entry(info, &shard_ctrl->clnt_info_list, next) { if (info->clnt == clnt) { *root_uuid = info->root_uuid; - read_unlock(&shard_ctrl->clnt_info_lock); - return 0; + goto out; } } + ret = -1; + +out: read_unlock(&shard_ctrl->clnt_info_lock); - return -1; + return ret; } static int enfs_insert_clnt_root(struct rpc_clnt *clnt, struct enfs_file_uuid *root_uuid) { + int ret = 0; struct clnt_uuid_info *info; write_lock(&shard_ctrl->clnt_info_lock); list_for_each_entry(info, &shard_ctrl->clnt_info_list, next) { if (info->clnt == clnt) { info->root_uuid = *root_uuid; - write_unlock(&shard_ctrl->clnt_info_lock); - return 0; + goto out; } } info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) { - write_unlock(&shard_ctrl->clnt_info_lock); - return -1; + ret = -1; + goto out; } info->clnt = clnt; @@ -152,12 +155,14 @@ static int enfs_insert_clnt_root(struct rpc_clnt *clnt, struct enfs_file_uuid *r list_add_tail(&info->next, &shard_ctrl->clnt_info_list); info->updating = false; +out: write_unlock(&shard_ctrl->clnt_info_lock); - return 0; + return ret; } int enfs_delete_clnt_shard_cache(struct rpc_clnt *clnt) { + int ret = 0; struct clnt_uuid_info *info; uint64_t devId = 0; @@ -170,10 +175,8 @@ int enfs_delete_clnt_shard_cache(struct rpc_clnt *clnt) break; } } - if (devId == 0) { - write_unlock(&shard_ctrl->clnt_info_lock); - return 0; - } + if (devId == 0) + goto out; list_for_each_entry(info, &shard_ctrl->clnt_info_list, next) { if (devId == GET_DEVID_FROM_UUID(&info->root_uuid)) { @@ -188,8 +191,9 @@ int enfs_delete_clnt_shard_cache(struct rpc_clnt *clnt) write_unlock(&shard_ctrl->view_lock); } +out: write_unlock(&shard_ctrl->clnt_info_lock); - return 0; + return ret; } static struct view_table *create_view_table(uint64_t devId) @@ -327,7 +331,7 @@ static int get_ls_and_cpu_id(struct view_table *table, uint64_t clusterId, static int enfs_query_lif_info(struct rpc_clnt *clnt, struct enfs_file_uuid *file_uuid, uint64_t *lsid, uint32_t *cpuId) { - int ret; + int ret = 0; struct view_table *table; struct fs_info *info; uint32_t shardId; @@ -335,25 +339,25 @@ static int enfs_query_lif_info(struct rpc_clnt *clnt, struct enfs_file_uuid *fil read_lock(&shard_ctrl->view_lock); table = get_view_table(GET_DEVID_FROM_UUID(file_uuid), false); if (!table) { - read_unlock(&shard_ctrl->view_lock); - return -1; + ret = -1; + goto out; } info = get_fsinfo(table, GET_FSID_FROM_UUID(file_uuid)); if (!info) { - read_unlock(&shard_ctrl->view_lock); - return -1; + ret = -1; + goto out; } shardId = get_shardid_from_uuid(file_uuid); - ret = - get_ls_and_cpu_id(table, info->clusterId, info->storagePoolId, - shardId, lsid, cpuId); + ret = get_ls_and_cpu_id(table, info->clusterId, info->storagePoolId, + shardId, lsid, cpuId); if (ret) { - read_unlock(&shard_ctrl->view_lock); enfs_log_error("get lsid failed.\n"); - return ret; + goto out; } + +out: read_unlock(&shard_ctrl->view_lock); return ret; } @@ -426,33 +430,32 @@ static int update_shard_view(struct view_table *table, static int enfs_update_fsshard(uint64_t devId, struct enfs_shard_view *fs_shard_view, int *flag) { - int ret; + int ret = 0; struct view_table *table; write_lock(&shard_ctrl->view_lock); table = get_view_table(devId, true); if (!table) { - write_unlock(&shard_ctrl->view_lock); enfs_log_error("get view table failed.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto out; } ret = update_fs_info(table, fs_shard_view); if (ret) { - write_unlock(&shard_ctrl->view_lock); enfs_log_error("update fs info err:%d\n", ret); - return ret; + goto out; } ret = update_shard_view(table, fs_shard_view, flag); if (ret) { - write_unlock(&shard_ctrl->view_lock); enfs_log_error("update shard view err:%d\n", ret); - return ret; + goto out; } +out: write_unlock(&shard_ctrl->view_lock); - return 0; + return ret; } static int find_same_lsid(struct ls_info *info, int size, int target_lsId) @@ -520,26 +523,26 @@ static int update_ls_info(struct view_table *table, static int enfs_update_lsinfo(uint64_t devId, struct enfs_get_ls_version_rsp *ls_view, int *flag) { - int ret; + int ret = 0; struct view_table *table; write_lock(&shard_ctrl->view_lock); table = get_view_table(devId, true); if (!table) { - write_unlock(&shard_ctrl->view_lock); enfs_log_error("get view table failed.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto out; } ret = update_ls_info(table, ls_view, flag); if (ret) { - write_unlock(&shard_ctrl->view_lock); enfs_log_error("update ls info err:%d\n", ret); - return ret; + goto out; } +out: write_unlock(&shard_ctrl->view_lock); - return 0; + return ret; } // getattr,fsstat,fsinfo,pathconf @@ -930,17 +933,15 @@ static struct rpc_xprt *enfs_get_shard_xport(struct rpc_clnt *clnt, uint32_t cpuId) { struct rpc_xprt *old; - struct rpc_xprt *xprt; + struct rpc_xprt *xprt = NULL; struct rpc_xprt_switch *xps; struct rpc_xprt_iter *xpi = &clnt->cl_xpi; struct enfs_xprt_context *context; rcu_read_lock(); xps = rcu_dereference(xpi->xpi_xpswitch); - if (xps == NULL) { - rcu_read_unlock(); - return NULL; - } + if (xps == NULL) + goto out; old = smp_load_acquire(&xpi->xpi_cursor); // multi thread access xprt = enfs_choose_shard_xport(xps, old, lsid, clnt, cpuId); smp_store_release(&xpi->xpi_cursor, xprt); // multi thread access @@ -951,17 +952,16 @@ static struct rpc_xprt *enfs_get_shard_xport(struct rpc_clnt *clnt, rpc_task_release_transport(task); } - if (xprt == NULL) { - rcu_read_unlock(); - return NULL; - } + if (xprt == NULL) + goto out; xprt = xprt_get(xprt); context = xprt_get_reserve_context(xprt); if (context) atomic_long_inc(&context->queuelen); - rcu_read_unlock(); +out: + rcu_read_unlock(); return xprt; } @@ -1153,19 +1153,18 @@ static void debug_show_shardinfo(int argc, char *argv[]) static int get_ip_to_str(struct sockaddr *addr, char *buf, int len) { - switch (addr->sa_family) { - case AF_INET:{ - struct sockaddr_in *sin = (struct sockaddr_in *)addr; - - snprintf(buf, len, "%pI4", &sin->sin_addr); - return 0; - } - case AF_INET6:{ - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; - snprintf(buf, len, "%pI6c", &sin6->sin6_addr); - return 0; - } + switch (addr->sa_family) { + case AF_INET: + sin = (struct sockaddr_in *)addr; + snprintf(buf, len, "%pI4", &sin->sin_addr); + return 0; + case AF_INET6: + sin6 = (struct sockaddr_in6 *)addr; + snprintf(buf, len, "%pI6c", &sin6->sin6_addr); + return 0; default: break; } @@ -1683,7 +1682,7 @@ static int shard_update_loop(void *data) return 0; } -static void enfs_clear_shard_ctrl(void) +static void enfs_shard_ctrl_clear(void) { struct clnt_uuid_info *info, *tmp_info; struct view_table *table, *tmp_table; @@ -1700,18 +1699,15 @@ static void enfs_clear_shard_ctrl(void) enfs_free_view_table(table); } write_unlock(&shard_ctrl->view_lock); + + kfree(shard_ctrl); + shard_ctrl = NULL; } static struct shard_view_ctrl *enfs_shard_ctrl_init(void) { struct shard_view_ctrl *ctrl; - ctrl = enfs_adapter_get_data(); - if (ctrl) { - enfs_log_info("existing shard ctrl is obtained.\n"); - return ctrl; - } - ctrl = kmalloc(sizeof(*ctrl), GFP_KERNEL); if (!ctrl) { enfs_log_error("shard view ctrl alloc failed.\n"); @@ -1722,7 +1718,6 @@ static struct shard_view_ctrl *enfs_shard_ctrl_init(void) rwlock_init(&ctrl->view_lock); INIT_LIST_HEAD(&ctrl->clnt_info_list); rwlock_init(&ctrl->clnt_info_lock); - enfs_adapter_set_data((void *)ctrl); return ctrl; } @@ -1759,5 +1754,6 @@ void enfs_shard_exit(void) destroy_workqueue(shard_workq); } - enfs_clear_shard_ctrl(); + if (shard_ctrl) + enfs_shard_ctrl_clear(); } diff --git a/fs/nfs/enfs_adapter.c b/fs/nfs/enfs_adapter.c index 470eef06eb21a515c6effa6c327006c571572da5..1d3c3a3c9f201664e32a88e680e91727dd976f0d 100644 --- a/fs/nfs/enfs_adapter.c +++ b/fs/nfs/enfs_adapter.c @@ -19,19 +19,6 @@ static struct enfs_adapter_ops __rcu *enfs_adapter; static DEFINE_MUTEX(enfs_module_mutex); -static void *enfs_adapter_data; - -void *enfs_adapter_get_data(void) -{ - return enfs_adapter_data; -} -EXPORT_SYMBOL_GPL(enfs_adapter_get_data); - -void enfs_adapter_set_data(void *data) -{ - enfs_adapter_data = data; -} -EXPORT_SYMBOL_GPL(enfs_adapter_set_data); int enfs_adapter_register(struct enfs_adapter_ops *ops) { diff --git a/fs/nfs/enfs_adapter.h b/fs/nfs/enfs_adapter.h index 9cd2e2acdfd324e2b4616101441a4e891e5eea19..e6f1271812783cdb233714527e19de7fb6cd6c24 100644 --- a/fs/nfs/enfs_adapter.h +++ b/fs/nfs/enfs_adapter.h @@ -47,9 +47,6 @@ struct enfs_adapter_ops { void (*trigger_get_capability)(struct nfs_server *server); }; -void *enfs_adapter_get_data(void); -void enfs_adapter_set_data(void *data); - int enfs_parse_mount_options(enum nfsmultipathoptions option, char *str, struct nfs_fs_context *mnt, struct fs_context *fc); void enfs_free_mount_options(struct nfs_fs_context *data); diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 09b35d932c7048ba1615e697528e6c6d268f73bc..0fb4b34b184ce77558b2e323a63a09546ce08fa5 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -38,33 +38,6 @@ struct rpc_sysfs_client { struct rpc_xprt_switch *xprt_switch; }; -#if IS_ENABLED(CONFIG_SUNRPC_ENFS) -struct rpc_clnt_reserve { - atomic_t cl_count; /* Number of references */ - unsigned int cl_clid; /* client id */ - struct list_head cl_clients; /* Global list of clients */ - struct list_head cl_tasks; /* List of tasks */ - spinlock_t cl_lock; /* spinlock */ - struct rpc_xprt __rcu *cl_xprt; /* transport */ - const struct rpc_procinfo *cl_procinfo; /* procedure info */ - u32 cl_prog, /* RPC program number */ - cl_vers, /* RPC version number */ - cl_maxproc; /* max procedure number */ - - struct rpc_auth *cl_auth; /* authenticator */ - struct rpc_stat *cl_stats; /* per-program statistics */ - struct rpc_iostats *cl_metrics; /* per-client statistics */ - - unsigned int cl_softrtry : 1,/* soft timeouts */ - cl_discrtry : 1,/* disconnect before retry */ - cl_noretranstimeo: 1,/* No retransmit timeouts */ - cl_autobind : 1,/* use getport() */ - cl_chatty : 1,/* be verbose */ - cl_reserve : 11,/* reserve bits */ - cl_enfs : 1;/* be enfs */ -}; -#endif - /* * The high-level client handle */ @@ -91,7 +64,12 @@ struct rpc_clnt { cl_noretranstimeo: 1,/* No retransmit timeouts */ cl_autobind : 1,/* use getport() */ cl_chatty : 1,/* be verbose */ +#if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_SUNRPC_ENFS) cl_shutdown : 1;/* rpc immediate -EIO */ +#else + cl_shutdown : 1,/* rpc immediate -EIO */ + cl_enfs : 1;/* be enfs */ +#endif struct xprtsec_parms cl_xprtsec; /* transport security policy */ struct rpc_rtt * cl_rtt; /* RTO estimator data */ diff --git a/net/sunrpc/sunrpc_enfs_adapter.c b/net/sunrpc/sunrpc_enfs_adapter.c index 2515a9945d43b663a868b414182f63e6182de39b..5905b9ccde4ccc2836be4a6b6a26022e52472a28 100644 --- a/net/sunrpc/sunrpc_enfs_adapter.c +++ b/net/sunrpc/sunrpc_enfs_adapter.c @@ -216,11 +216,7 @@ void rpc_multipath_ops_update_rpc_program(struct rpc_task *task, u32 *cl_prog, u bool rpc_clnt_has_multipath(struct rpc_clnt *clnt) { - struct rpc_clnt_reserve *clnt_reserve; - - clnt_reserve = (struct rpc_clnt_reserve *)clnt; - - return clnt_reserve->cl_enfs ? true : false; + return clnt->cl_enfs ? true : false; } void rpc_multipath_ops_xprt_iostat(struct rpc_task *task)