diff options
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 520859622af5..7f8c60b84396 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -983,19 +983,23 @@ struct rpc_xprt *xprt_create_transport(struct rpc_xprtsock_create *args) | |||
983 | { | 983 | { |
984 | struct rpc_xprt *xprt; | 984 | struct rpc_xprt *xprt; |
985 | struct rpc_rqst *req; | 985 | struct rpc_rqst *req; |
986 | struct xprt_class *t; | ||
986 | 987 | ||
987 | switch (args->proto) { | 988 | spin_lock(&xprt_list_lock); |
988 | case IPPROTO_UDP: | 989 | list_for_each_entry(t, &xprt_list, list) { |
989 | xprt = xs_setup_udp(args); | 990 | if ((t->family == args->dstaddr->sa_family) && |
990 | break; | 991 | (t->protocol == args->proto)) { |
991 | case IPPROTO_TCP: | 992 | spin_unlock(&xprt_list_lock); |
992 | xprt = xs_setup_tcp(args); | 993 | goto found; |
993 | break; | 994 | } |
994 | default: | ||
995 | printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n", | ||
996 | args->proto); | ||
997 | return ERR_PTR(-EIO); | ||
998 | } | 995 | } |
996 | spin_unlock(&xprt_list_lock); | ||
997 | printk(KERN_ERR "RPC: transport (%u/%d) not supported\n", | ||
998 | args->dstaddr->sa_family, args->proto); | ||
999 | return ERR_PTR(-EIO); | ||
1000 | |||
1001 | found: | ||
1002 | xprt = t->setup(args); | ||
999 | if (IS_ERR(xprt)) { | 1003 | if (IS_ERR(xprt)) { |
1000 | dprintk("RPC: xprt_create_transport: failed, %ld\n", | 1004 | dprintk("RPC: xprt_create_transport: failed, %ld\n", |
1001 | -PTR_ERR(xprt)); | 1005 | -PTR_ERR(xprt)); |