mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
SUNRPC: xprt_load_transport() needs to support the netid "rdma6"
According to RFC5666, the correct netid for an IPv6 addressed RDMA
transport is "rdma6", which we've supported as a mount option since
Linux-4.7. The problem is when we try to load the module "xprtrdma6",
that will fail, since there is no modulealias of that name.
Fixes: 181342c5eb
("xprtrdma: Add rdma6 option to support NFS/RDMA IPv6")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
@@ -330,6 +330,7 @@ struct xprt_class {
|
|||||||
struct rpc_xprt * (*setup)(struct xprt_create *);
|
struct rpc_xprt * (*setup)(struct xprt_create *);
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
char name[32];
|
char name[32];
|
||||||
|
const char * netid[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -151,31 +151,64 @@ out:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xprt_unregister_transport);
|
EXPORT_SYMBOL_GPL(xprt_unregister_transport);
|
||||||
|
|
||||||
|
static void
|
||||||
|
xprt_class_release(const struct xprt_class *t)
|
||||||
|
{
|
||||||
|
module_put(t->owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct xprt_class *
|
||||||
|
xprt_class_find_by_netid_locked(const char *netid)
|
||||||
|
{
|
||||||
|
const struct xprt_class *t;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
list_for_each_entry(t, &xprt_list, list) {
|
||||||
|
for (i = 0; t->netid[i][0] != '\0'; i++) {
|
||||||
|
if (strcmp(t->netid[i], netid) != 0)
|
||||||
|
continue;
|
||||||
|
if (!try_module_get(t->owner))
|
||||||
|
continue;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct xprt_class *
|
||||||
|
xprt_class_find_by_netid(const char *netid)
|
||||||
|
{
|
||||||
|
const struct xprt_class *t;
|
||||||
|
|
||||||
|
spin_lock(&xprt_list_lock);
|
||||||
|
t = xprt_class_find_by_netid_locked(netid);
|
||||||
|
if (!t) {
|
||||||
|
spin_unlock(&xprt_list_lock);
|
||||||
|
request_module("rpc%s", netid);
|
||||||
|
spin_lock(&xprt_list_lock);
|
||||||
|
t = xprt_class_find_by_netid_locked(netid);
|
||||||
|
}
|
||||||
|
spin_unlock(&xprt_list_lock);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xprt_load_transport - load a transport implementation
|
* xprt_load_transport - load a transport implementation
|
||||||
* @transport_name: transport to load
|
* @netid: transport to load
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0: transport successfully loaded
|
* 0: transport successfully loaded
|
||||||
* -ENOENT: transport module not available
|
* -ENOENT: transport module not available
|
||||||
*/
|
*/
|
||||||
int xprt_load_transport(const char *transport_name)
|
int xprt_load_transport(const char *netid)
|
||||||
{
|
{
|
||||||
struct xprt_class *t;
|
const struct xprt_class *t;
|
||||||
int result;
|
|
||||||
|
|
||||||
result = 0;
|
t = xprt_class_find_by_netid(netid);
|
||||||
spin_lock(&xprt_list_lock);
|
if (!t)
|
||||||
list_for_each_entry(t, &xprt_list, list) {
|
return -ENOENT;
|
||||||
if (strcmp(t->name, transport_name) == 0) {
|
xprt_class_release(t);
|
||||||
spin_unlock(&xprt_list_lock);
|
return 0;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spin_unlock(&xprt_list_lock);
|
|
||||||
result = request_module("xprt%s", transport_name);
|
|
||||||
out:
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xprt_load_transport);
|
EXPORT_SYMBOL_GPL(xprt_load_transport);
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ MODULE_DESCRIPTION("RPC/RDMA Transport");
|
|||||||
MODULE_LICENSE("Dual BSD/GPL");
|
MODULE_LICENSE("Dual BSD/GPL");
|
||||||
MODULE_ALIAS("svcrdma");
|
MODULE_ALIAS("svcrdma");
|
||||||
MODULE_ALIAS("xprtrdma");
|
MODULE_ALIAS("xprtrdma");
|
||||||
|
MODULE_ALIAS("rpcrdma6");
|
||||||
|
|
||||||
static void __exit rpc_rdma_cleanup(void)
|
static void __exit rpc_rdma_cleanup(void)
|
||||||
{
|
{
|
||||||
|
@@ -768,6 +768,7 @@ static struct xprt_class xprt_rdma = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.ident = XPRT_TRANSPORT_RDMA,
|
.ident = XPRT_TRANSPORT_RDMA,
|
||||||
.setup = xprt_setup_rdma,
|
.setup = xprt_setup_rdma,
|
||||||
|
.netid = { "rdma", "rdma6", "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
void xprt_rdma_cleanup(void)
|
void xprt_rdma_cleanup(void)
|
||||||
|
@@ -3059,6 +3059,7 @@ static struct xprt_class xs_local_transport = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.ident = XPRT_TRANSPORT_LOCAL,
|
.ident = XPRT_TRANSPORT_LOCAL,
|
||||||
.setup = xs_setup_local,
|
.setup = xs_setup_local,
|
||||||
|
.netid = { "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct xprt_class xs_udp_transport = {
|
static struct xprt_class xs_udp_transport = {
|
||||||
@@ -3067,6 +3068,7 @@ static struct xprt_class xs_udp_transport = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.ident = XPRT_TRANSPORT_UDP,
|
.ident = XPRT_TRANSPORT_UDP,
|
||||||
.setup = xs_setup_udp,
|
.setup = xs_setup_udp,
|
||||||
|
.netid = { "udp", "udp6", "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct xprt_class xs_tcp_transport = {
|
static struct xprt_class xs_tcp_transport = {
|
||||||
@@ -3075,6 +3077,7 @@ static struct xprt_class xs_tcp_transport = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.ident = XPRT_TRANSPORT_TCP,
|
.ident = XPRT_TRANSPORT_TCP,
|
||||||
.setup = xs_setup_tcp,
|
.setup = xs_setup_tcp,
|
||||||
|
.netid = { "tcp", "tcp6", "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct xprt_class xs_bc_tcp_transport = {
|
static struct xprt_class xs_bc_tcp_transport = {
|
||||||
@@ -3083,6 +3086,7 @@ static struct xprt_class xs_bc_tcp_transport = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.ident = XPRT_TRANSPORT_BC_TCP,
|
.ident = XPRT_TRANSPORT_BC_TCP,
|
||||||
.setup = xs_setup_bc_tcp,
|
.setup = xs_setup_bc_tcp,
|
||||||
|
.netid = { "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user