diff options
-rw-r--r-- | fs/nfs/mount_clnt.c | 13 | ||||
-rw-r--r-- | fs/nfsd/nfs4callback.c | 6 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 13 |
3 files changed, 17 insertions, 15 deletions
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 878d7a5cb6d4..2892ec843066 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -28,8 +28,7 @@ | |||
28 | #define MOUNT_UMNT 3 | 28 | #define MOUNT_UMNT 3 |
29 | */ | 29 | */ |
30 | 30 | ||
31 | static struct rpc_clnt * mnt_create(char *, struct sockaddr_in *, | 31 | static struct rpc_clnt * mnt_create(struct sockaddr_in *, int, int); |
32 | int, int); | ||
33 | static struct rpc_program mnt_program; | 32 | static struct rpc_program mnt_program; |
34 | 33 | ||
35 | struct mnt_fhstatus { | 34 | struct mnt_fhstatus { |
@@ -52,14 +51,12 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, | |||
52 | .rpc_argp = path, | 51 | .rpc_argp = path, |
53 | .rpc_resp = &result, | 52 | .rpc_resp = &result, |
54 | }; | 53 | }; |
55 | char hostname[32]; | ||
56 | int status; | 54 | int status; |
57 | 55 | ||
58 | dprintk("NFS: nfs_mount(%08x:%s)\n", | 56 | dprintk("NFS: nfs_mount(%08x:%s)\n", |
59 | (unsigned)ntohl(addr->sin_addr.s_addr), path); | 57 | (unsigned)ntohl(addr->sin_addr.s_addr), path); |
60 | 58 | ||
61 | sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(addr->sin_addr.s_addr)); | 59 | mnt_clnt = mnt_create(addr, version, protocol); |
62 | mnt_clnt = mnt_create(hostname, addr, version, protocol); | ||
63 | if (IS_ERR(mnt_clnt)) | 60 | if (IS_ERR(mnt_clnt)) |
64 | return PTR_ERR(mnt_clnt); | 61 | return PTR_ERR(mnt_clnt); |
65 | 62 | ||
@@ -73,15 +70,13 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, | |||
73 | return status < 0? status : (result.status? -EACCES : 0); | 70 | return status < 0? status : (result.status? -EACCES : 0); |
74 | } | 71 | } |
75 | 72 | ||
76 | static struct rpc_clnt * | 73 | static struct rpc_clnt *mnt_create(struct sockaddr_in *srvaddr, int version, |
77 | mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version, | 74 | int protocol) |
78 | int protocol) | ||
79 | { | 75 | { |
80 | struct rpc_create_args args = { | 76 | struct rpc_create_args args = { |
81 | .protocol = protocol, | 77 | .protocol = protocol, |
82 | .address = (struct sockaddr *)srvaddr, | 78 | .address = (struct sockaddr *)srvaddr, |
83 | .addrsize = sizeof(*srvaddr), | 79 | .addrsize = sizeof(*srvaddr), |
84 | .servername = hostname, | ||
85 | .program = &mnt_program, | 80 | .program = &mnt_program, |
86 | .version = version, | 81 | .version = version, |
87 | .authflavor = RPC_AUTH_UNIX, | 82 | .authflavor = RPC_AUTH_UNIX, |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 6b1b487db1ec..5443c52b57aa 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -394,7 +394,6 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
394 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], | 394 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], |
395 | .rpc_argp = clp, | 395 | .rpc_argp = clp, |
396 | }; | 396 | }; |
397 | char clientname[16]; | ||
398 | int status; | 397 | int status; |
399 | 398 | ||
400 | if (atomic_read(&cb->cb_set)) | 399 | if (atomic_read(&cb->cb_set)) |
@@ -417,11 +416,6 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
417 | memset(program->stats, 0, sizeof(cb->cb_stat)); | 416 | memset(program->stats, 0, sizeof(cb->cb_stat)); |
418 | program->stats->program = program; | 417 | program->stats->program = program; |
419 | 418 | ||
420 | /* Just here to make some printk's more useful: */ | ||
421 | snprintf(clientname, sizeof(clientname), | ||
422 | "%u.%u.%u.%u", NIPQUAD(addr.sin_addr)); | ||
423 | args.servername = clientname; | ||
424 | |||
425 | /* Create RPC client */ | 419 | /* Create RPC client */ |
426 | cb->cb_client = rpc_create(&args); | 420 | cb->cb_client = rpc_create(&args); |
427 | if (IS_ERR(cb->cb_client)) { | 421 | if (IS_ERR(cb->cb_client)) { |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e1553cf2a68f..0d9b5275fac3 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -234,6 +234,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
234 | { | 234 | { |
235 | struct rpc_xprt *xprt; | 235 | struct rpc_xprt *xprt; |
236 | struct rpc_clnt *clnt; | 236 | struct rpc_clnt *clnt; |
237 | char servername[20]; | ||
237 | 238 | ||
238 | xprt = xprt_create_transport(args->protocol, args->address, | 239 | xprt = xprt_create_transport(args->protocol, args->address, |
239 | args->addrsize, args->timeout); | 240 | args->addrsize, args->timeout); |
@@ -241,6 +242,18 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
241 | return (struct rpc_clnt *)xprt; | 242 | return (struct rpc_clnt *)xprt; |
242 | 243 | ||
243 | /* | 244 | /* |
245 | * If the caller chooses not to specify a hostname, whip | ||
246 | * up a string representation of the passed-in address. | ||
247 | */ | ||
248 | if (args->servername == NULL) { | ||
249 | struct sockaddr_in *addr = | ||
250 | (struct sockaddr_in *) &args->address; | ||
251 | snprintf(servername, sizeof(servername), NIPQUAD_FMT, | ||
252 | NIPQUAD(addr->sin_addr.s_addr)); | ||
253 | args->servername = servername; | ||
254 | } | ||
255 | |||
256 | /* | ||
244 | * By default, kernel RPC client connects from a reserved port. | 257 | * By default, kernel RPC client connects from a reserved port. |
245 | * CAP_NET_BIND_SERVICE will not be set for unprivileged requesters, | 258 | * CAP_NET_BIND_SERVICE will not be set for unprivileged requesters, |
246 | * but it is always enabled for rpciod, which handles the connect | 259 | * but it is always enabled for rpciod, which handles the connect |