NFS/SUNRPC: use transport protocol naming
Instead of an { address family, raw IP protocol number }-tuple, use the newly-defined RPC identifier when creating clients in the upper layers. Signed-off-by: Tom Talpey <tmt@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
4fa016eb24
commit
0896a725a1
|
@ -10,6 +10,7 @@
|
||||||
#include <linux/utsname.h>
|
#include <linux/utsname.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/sunrpc/clnt.h>
|
#include <linux/sunrpc/clnt.h>
|
||||||
|
#include <linux/sunrpc/xprtsock.h>
|
||||||
#include <linux/sunrpc/svc.h>
|
#include <linux/sunrpc/svc.h>
|
||||||
#include <linux/lockd/lockd.h>
|
#include <linux/lockd/lockd.h>
|
||||||
#include <linux/lockd/sm_inter.h>
|
#include <linux/lockd/sm_inter.h>
|
||||||
|
@ -132,7 +133,7 @@ nsm_create(void)
|
||||||
.sin_port = 0,
|
.sin_port = 0,
|
||||||
};
|
};
|
||||||
struct rpc_create_args args = {
|
struct rpc_create_args args = {
|
||||||
.protocol = IPPROTO_UDP,
|
.protocol = XPRT_TRANSPORT_UDP,
|
||||||
.address = (struct sockaddr *)&sin,
|
.address = (struct sockaddr *)&sin,
|
||||||
.addrsize = sizeof(sin),
|
.addrsize = sizeof(sin),
|
||||||
.servername = "localhost",
|
.servername = "localhost",
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <linux/sunrpc/clnt.h>
|
#include <linux/sunrpc/clnt.h>
|
||||||
#include <linux/sunrpc/stats.h>
|
#include <linux/sunrpc/stats.h>
|
||||||
#include <linux/sunrpc/metrics.h>
|
#include <linux/sunrpc/metrics.h>
|
||||||
|
#include <linux/sunrpc/xprtsock.h>
|
||||||
#include <linux/nfs_fs.h>
|
#include <linux/nfs_fs.h>
|
||||||
#include <linux/nfs_mount.h>
|
#include <linux/nfs_mount.h>
|
||||||
#include <linux/nfs4_mount.h>
|
#include <linux/nfs4_mount.h>
|
||||||
|
@ -340,7 +341,7 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
|
||||||
to->to_retries = 2;
|
to->to_retries = 2;
|
||||||
|
|
||||||
switch (proto) {
|
switch (proto) {
|
||||||
case IPPROTO_TCP:
|
case XPRT_TRANSPORT_TCP:
|
||||||
if (!to->to_initval)
|
if (!to->to_initval)
|
||||||
to->to_initval = 60 * HZ;
|
to->to_initval = 60 * HZ;
|
||||||
if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
|
if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
|
||||||
|
@ -349,7 +350,7 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
|
||||||
to->to_maxval = to->to_initval + (to->to_increment * to->to_retries);
|
to->to_maxval = to->to_initval + (to->to_increment * to->to_retries);
|
||||||
to->to_exponential = 0;
|
to->to_exponential = 0;
|
||||||
break;
|
break;
|
||||||
case IPPROTO_UDP:
|
case XPRT_TRANSPORT_UDP:
|
||||||
default:
|
default:
|
||||||
if (!to->to_initval)
|
if (!to->to_initval)
|
||||||
to->to_initval = 11 * HZ / 10;
|
to->to_initval = 11 * HZ / 10;
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/sunrpc/clnt.h>
|
#include <linux/sunrpc/clnt.h>
|
||||||
|
#include <linux/sunrpc/xprtsock.h>
|
||||||
#include <linux/nfs.h>
|
#include <linux/nfs.h>
|
||||||
#include <linux/nfs_fs.h>
|
#include <linux/nfs_fs.h>
|
||||||
#include <linux/nfs_mount.h>
|
#include <linux/nfs_mount.h>
|
||||||
|
@ -491,7 +492,7 @@ static int __init root_nfs_get_handle(void)
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
int status;
|
int status;
|
||||||
int protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
|
int protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
|
||||||
IPPROTO_TCP : IPPROTO_UDP;
|
XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP;
|
||||||
int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
|
int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
|
||||||
NFS_MNT3_VERSION : NFS_MNT_VERSION;
|
NFS_MNT3_VERSION : NFS_MNT_VERSION;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <linux/sunrpc/clnt.h>
|
#include <linux/sunrpc/clnt.h>
|
||||||
#include <linux/sunrpc/stats.h>
|
#include <linux/sunrpc/stats.h>
|
||||||
#include <linux/sunrpc/metrics.h>
|
#include <linux/sunrpc/metrics.h>
|
||||||
|
#include <linux/sunrpc/xprtsock.h>
|
||||||
#include <linux/nfs_fs.h>
|
#include <linux/nfs_fs.h>
|
||||||
#include <linux/nfs_mount.h>
|
#include <linux/nfs_mount.h>
|
||||||
#include <linux/nfs4_mount.h>
|
#include <linux/nfs4_mount.h>
|
||||||
|
@ -669,13 +670,13 @@ static int nfs_parse_mount_options(char *raw,
|
||||||
break;
|
break;
|
||||||
case Opt_udp:
|
case Opt_udp:
|
||||||
mnt->flags &= ~NFS_MOUNT_TCP;
|
mnt->flags &= ~NFS_MOUNT_TCP;
|
||||||
mnt->nfs_server.protocol = IPPROTO_UDP;
|
mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP;
|
||||||
mnt->timeo = 7;
|
mnt->timeo = 7;
|
||||||
mnt->retrans = 5;
|
mnt->retrans = 5;
|
||||||
break;
|
break;
|
||||||
case Opt_tcp:
|
case Opt_tcp:
|
||||||
mnt->flags |= NFS_MOUNT_TCP;
|
mnt->flags |= NFS_MOUNT_TCP;
|
||||||
mnt->nfs_server.protocol = IPPROTO_TCP;
|
mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP;
|
||||||
mnt->timeo = 600;
|
mnt->timeo = 600;
|
||||||
mnt->retrans = 2;
|
mnt->retrans = 2;
|
||||||
break;
|
break;
|
||||||
|
@ -884,13 +885,13 @@ static int nfs_parse_mount_options(char *raw,
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case Opt_xprt_udp:
|
case Opt_xprt_udp:
|
||||||
mnt->flags &= ~NFS_MOUNT_TCP;
|
mnt->flags &= ~NFS_MOUNT_TCP;
|
||||||
mnt->nfs_server.protocol = IPPROTO_UDP;
|
mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP;
|
||||||
mnt->timeo = 7;
|
mnt->timeo = 7;
|
||||||
mnt->retrans = 5;
|
mnt->retrans = 5;
|
||||||
break;
|
break;
|
||||||
case Opt_xprt_tcp:
|
case Opt_xprt_tcp:
|
||||||
mnt->flags |= NFS_MOUNT_TCP;
|
mnt->flags |= NFS_MOUNT_TCP;
|
||||||
mnt->nfs_server.protocol = IPPROTO_TCP;
|
mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP;
|
||||||
mnt->timeo = 600;
|
mnt->timeo = 600;
|
||||||
mnt->retrans = 2;
|
mnt->retrans = 2;
|
||||||
break;
|
break;
|
||||||
|
@ -908,10 +909,10 @@ static int nfs_parse_mount_options(char *raw,
|
||||||
|
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case Opt_xprt_udp:
|
case Opt_xprt_udp:
|
||||||
mnt->mount_server.protocol = IPPROTO_UDP;
|
mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
|
||||||
break;
|
break;
|
||||||
case Opt_xprt_tcp:
|
case Opt_xprt_tcp:
|
||||||
mnt->mount_server.protocol = IPPROTO_TCP;
|
mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto out_unrec_xprt;
|
goto out_unrec_xprt;
|
||||||
|
@ -1061,9 +1062,9 @@ static int nfs_validate_mount_data(void *options,
|
||||||
args->acregmax = 60;
|
args->acregmax = 60;
|
||||||
args->acdirmin = 30;
|
args->acdirmin = 30;
|
||||||
args->acdirmax = 60;
|
args->acdirmax = 60;
|
||||||
args->mount_server.protocol = IPPROTO_UDP;
|
args->mount_server.protocol = XPRT_TRANSPORT_UDP;
|
||||||
args->mount_server.program = NFS_MNT_PROGRAM;
|
args->mount_server.program = NFS_MNT_PROGRAM;
|
||||||
args->nfs_server.protocol = IPPROTO_TCP;
|
args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
|
||||||
args->nfs_server.program = NFS_PROGRAM;
|
args->nfs_server.program = NFS_PROGRAM;
|
||||||
|
|
||||||
switch (data->version) {
|
switch (data->version) {
|
||||||
|
@ -1110,7 +1111,7 @@ static int nfs_validate_mount_data(void *options,
|
||||||
args->acdirmax = data->acdirmax;
|
args->acdirmax = data->acdirmax;
|
||||||
args->nfs_server.address = data->addr;
|
args->nfs_server.address = data->addr;
|
||||||
if (!(data->flags & NFS_MOUNT_TCP))
|
if (!(data->flags & NFS_MOUNT_TCP))
|
||||||
args->nfs_server.protocol = IPPROTO_UDP;
|
args->nfs_server.protocol = XPRT_TRANSPORT_UDP;
|
||||||
/* N.B. caller will free nfs_server.hostname in all cases */
|
/* N.B. caller will free nfs_server.hostname in all cases */
|
||||||
args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
|
args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
|
||||||
args->namlen = data->namlen;
|
args->namlen = data->namlen;
|
||||||
|
@ -1533,7 +1534,7 @@ static int nfs4_validate_mount_data(void *options,
|
||||||
args->acregmax = 60;
|
args->acregmax = 60;
|
||||||
args->acdirmin = 30;
|
args->acdirmin = 30;
|
||||||
args->acdirmax = 60;
|
args->acdirmax = 60;
|
||||||
args->nfs_server.protocol = IPPROTO_TCP;
|
args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
|
||||||
|
|
||||||
switch (data->version) {
|
switch (data->version) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <linux/sunrpc/clnt.h>
|
#include <linux/sunrpc/clnt.h>
|
||||||
#include <linux/sunrpc/sched.h>
|
#include <linux/sunrpc/sched.h>
|
||||||
|
#include <linux/sunrpc/xprtsock.h>
|
||||||
|
|
||||||
#ifdef RPC_DEBUG
|
#ifdef RPC_DEBUG
|
||||||
# define RPCDBG_FACILITY RPCDBG_BIND
|
# define RPCDBG_FACILITY RPCDBG_BIND
|
||||||
|
@ -229,7 +230,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
|
||||||
prog, vers, prot, port);
|
prog, vers, prot, port);
|
||||||
|
|
||||||
rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
|
rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
|
||||||
IPPROTO_UDP, 2, 1);
|
XPRT_TRANSPORT_UDP, 2, 1);
|
||||||
if (IS_ERR(rpcb_clnt))
|
if (IS_ERR(rpcb_clnt))
|
||||||
return PTR_ERR(rpcb_clnt);
|
return PTR_ERR(rpcb_clnt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue