aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-02-17 15:11:43 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-17 15:11:43 -0500
commitf630fe2817601314b2eb7ca5ddc23c7834646731 (patch)
tree3bfb4939b7bbc3859575ca8b58fa3f929b015941 /net/sunrpc/xprtsock.c
parent48c871c1f6a7c7044dd76774fb469e65c7e2e4e8 (diff)
parent8a03d9a498eaf02c8a118752050a5154852c13bf (diff)
Merge branch 'master' into upstream
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c117
1 files changed, 59 insertions, 58 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 49cabffd7fdb..a5a32029e728 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -18,7 +18,6 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/sched.h>
22#include <linux/pagemap.h> 21#include <linux/pagemap.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/socket.h> 23#include <linux/socket.h>
@@ -192,7 +191,7 @@ static void xs_pktdump(char *msg, u32 *packet, unsigned int count)
192 u8 *buf = (u8 *) packet; 191 u8 *buf = (u8 *) packet;
193 int j; 192 int j;
194 193
195 dprintk("RPC: %s\n", msg); 194 dprintk("RPC: %s\n", msg);
196 for (j = 0; j < count && j < 128; j += 4) { 195 for (j = 0; j < count && j < 128; j += 4) {
197 if (!(j & 31)) { 196 if (!(j & 31)) {
198 if (j) 197 if (j)
@@ -418,7 +417,7 @@ static void xs_nospace(struct rpc_task *task)
418 struct rpc_xprt *xprt = req->rq_xprt; 417 struct rpc_xprt *xprt = req->rq_xprt;
419 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 418 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
420 419
421 dprintk("RPC: %4d xmit incomplete (%u left of %u)\n", 420 dprintk("RPC: %5u xmit incomplete (%u left of %u)\n",
422 task->tk_pid, req->rq_slen - req->rq_bytes_sent, 421 task->tk_pid, req->rq_slen - req->rq_bytes_sent,
423 req->rq_slen); 422 req->rq_slen);
424 423
@@ -467,7 +466,7 @@ static int xs_udp_send_request(struct rpc_task *task)
467 xprt->addrlen, xdr, 466 xprt->addrlen, xdr,
468 req->rq_bytes_sent); 467 req->rq_bytes_sent);
469 468
470 dprintk("RPC: xs_udp_send_request(%u) = %d\n", 469 dprintk("RPC: xs_udp_send_request(%u) = %d\n",
471 xdr->len - req->rq_bytes_sent, status); 470 xdr->len - req->rq_bytes_sent, status);
472 471
473 if (likely(status >= (int) req->rq_slen)) 472 if (likely(status >= (int) req->rq_slen))
@@ -488,7 +487,7 @@ static int xs_udp_send_request(struct rpc_task *task)
488 xs_nospace(task); 487 xs_nospace(task);
489 break; 488 break;
490 default: 489 default:
491 dprintk("RPC: sendmsg returned unrecognized error %d\n", 490 dprintk("RPC: sendmsg returned unrecognized error %d\n",
492 -status); 491 -status);
493 break; 492 break;
494 } 493 }
@@ -539,7 +538,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
539 status = xs_sendpages(transport->sock, 538 status = xs_sendpages(transport->sock,
540 NULL, 0, xdr, req->rq_bytes_sent); 539 NULL, 0, xdr, req->rq_bytes_sent);
541 540
542 dprintk("RPC: xs_tcp_send_request(%u) = %d\n", 541 dprintk("RPC: xs_tcp_send_request(%u) = %d\n",
543 xdr->len - req->rq_bytes_sent, status); 542 xdr->len - req->rq_bytes_sent, status);
544 543
545 if (unlikely(status < 0)) 544 if (unlikely(status < 0))
@@ -570,7 +569,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
570 status = -ENOTCONN; 569 status = -ENOTCONN;
571 break; 570 break;
572 default: 571 default:
573 dprintk("RPC: sendmsg returned unrecognized error %d\n", 572 dprintk("RPC: sendmsg returned unrecognized error %d\n",
574 -status); 573 -status);
575 xprt_disconnect(xprt); 574 xprt_disconnect(xprt);
576 break; 575 break;
@@ -622,7 +621,7 @@ static void xs_close(struct rpc_xprt *xprt)
622 if (!sk) 621 if (!sk)
623 goto clear_close_wait; 622 goto clear_close_wait;
624 623
625 dprintk("RPC: xs_close xprt %p\n", xprt); 624 dprintk("RPC: xs_close xprt %p\n", xprt);
626 625
627 write_lock_bh(&sk->sk_callback_lock); 626 write_lock_bh(&sk->sk_callback_lock);
628 transport->inet = NULL; 627 transport->inet = NULL;
@@ -652,7 +651,7 @@ static void xs_destroy(struct rpc_xprt *xprt)
652{ 651{
653 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 652 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
654 653
655 dprintk("RPC: xs_destroy xprt %p\n", xprt); 654 dprintk("RPC: xs_destroy xprt %p\n", xprt);
656 655
657 cancel_delayed_work(&transport->connect_worker); 656 cancel_delayed_work(&transport->connect_worker);
658 flush_scheduled_work(); 657 flush_scheduled_work();
@@ -686,7 +685,7 @@ static void xs_udp_data_ready(struct sock *sk, int len)
686 __be32 *xp; 685 __be32 *xp;
687 686
688 read_lock(&sk->sk_callback_lock); 687 read_lock(&sk->sk_callback_lock);
689 dprintk("RPC: xs_udp_data_ready...\n"); 688 dprintk("RPC: xs_udp_data_ready...\n");
690 if (!(xprt = xprt_from_sock(sk))) 689 if (!(xprt = xprt_from_sock(sk)))
691 goto out; 690 goto out;
692 691
@@ -698,7 +697,7 @@ static void xs_udp_data_ready(struct sock *sk, int len)
698 697
699 repsize = skb->len - sizeof(struct udphdr); 698 repsize = skb->len - sizeof(struct udphdr);
700 if (repsize < 4) { 699 if (repsize < 4) {
701 dprintk("RPC: impossible RPC reply size %d!\n", repsize); 700 dprintk("RPC: impossible RPC reply size %d!\n", repsize);
702 goto dropit; 701 goto dropit;
703 } 702 }
704 703
@@ -762,11 +761,11 @@ static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, struct xdr_skb_rea
762 761
763 /* Sanity check of the record length */ 762 /* Sanity check of the record length */
764 if (unlikely(transport->tcp_reclen < 4)) { 763 if (unlikely(transport->tcp_reclen < 4)) {
765 dprintk("RPC: invalid TCP record fragment length\n"); 764 dprintk("RPC: invalid TCP record fragment length\n");
766 xprt_disconnect(xprt); 765 xprt_disconnect(xprt);
767 return; 766 return;
768 } 767 }
769 dprintk("RPC: reading TCP record fragment of length %d\n", 768 dprintk("RPC: reading TCP record fragment of length %d\n",
770 transport->tcp_reclen); 769 transport->tcp_reclen);
771} 770}
772 771
@@ -789,7 +788,7 @@ static inline void xs_tcp_read_xid(struct sock_xprt *transport, struct xdr_skb_r
789 char *p; 788 char *p;
790 789
791 len = sizeof(transport->tcp_xid) - transport->tcp_offset; 790 len = sizeof(transport->tcp_xid) - transport->tcp_offset;
792 dprintk("RPC: reading XID (%Zu bytes)\n", len); 791 dprintk("RPC: reading XID (%Zu bytes)\n", len);
793 p = ((char *) &transport->tcp_xid) + transport->tcp_offset; 792 p = ((char *) &transport->tcp_xid) + transport->tcp_offset;
794 used = xdr_skb_read_bits(desc, p, len); 793 used = xdr_skb_read_bits(desc, p, len);
795 transport->tcp_offset += used; 794 transport->tcp_offset += used;
@@ -798,7 +797,7 @@ static inline void xs_tcp_read_xid(struct sock_xprt *transport, struct xdr_skb_r
798 transport->tcp_flags &= ~TCP_RCV_COPY_XID; 797 transport->tcp_flags &= ~TCP_RCV_COPY_XID;
799 transport->tcp_flags |= TCP_RCV_COPY_DATA; 798 transport->tcp_flags |= TCP_RCV_COPY_DATA;
800 transport->tcp_copied = 4; 799 transport->tcp_copied = 4;
801 dprintk("RPC: reading reply for XID %08x\n", 800 dprintk("RPC: reading reply for XID %08x\n",
802 ntohl(transport->tcp_xid)); 801 ntohl(transport->tcp_xid));
803 xs_tcp_check_fraghdr(transport); 802 xs_tcp_check_fraghdr(transport);
804} 803}
@@ -816,7 +815,7 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, struct xdr_skb_rea
816 req = xprt_lookup_rqst(xprt, transport->tcp_xid); 815 req = xprt_lookup_rqst(xprt, transport->tcp_xid);
817 if (!req) { 816 if (!req) {
818 transport->tcp_flags &= ~TCP_RCV_COPY_DATA; 817 transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
819 dprintk("RPC: XID %08x request not found!\n", 818 dprintk("RPC: XID %08x request not found!\n",
820 ntohl(transport->tcp_xid)); 819 ntohl(transport->tcp_xid));
821 spin_unlock(&xprt->transport_lock); 820 spin_unlock(&xprt->transport_lock);
822 return; 821 return;
@@ -853,19 +852,20 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, struct xdr_skb_rea
853 * be discarded. 852 * be discarded.
854 */ 853 */
855 transport->tcp_flags &= ~TCP_RCV_COPY_DATA; 854 transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
856 dprintk("RPC: XID %08x truncated request\n", 855 dprintk("RPC: XID %08x truncated request\n",
857 ntohl(transport->tcp_xid)); 856 ntohl(transport->tcp_xid));
858 dprintk("RPC: xprt = %p, tcp_copied = %lu, tcp_offset = %u, tcp_reclen = %u\n", 857 dprintk("RPC: xprt = %p, tcp_copied = %lu, "
859 xprt, transport->tcp_copied, transport->tcp_offset, 858 "tcp_offset = %u, tcp_reclen = %u\n",
860 transport->tcp_reclen); 859 xprt, transport->tcp_copied,
860 transport->tcp_offset, transport->tcp_reclen);
861 goto out; 861 goto out;
862 } 862 }
863 863
864 dprintk("RPC: XID %08x read %Zd bytes\n", 864 dprintk("RPC: XID %08x read %Zd bytes\n",
865 ntohl(transport->tcp_xid), r); 865 ntohl(transport->tcp_xid), r);
866 dprintk("RPC: xprt = %p, tcp_copied = %lu, tcp_offset = %u, tcp_reclen = %u\n", 866 dprintk("RPC: xprt = %p, tcp_copied = %lu, tcp_offset = %u, "
867 xprt, transport->tcp_copied, transport->tcp_offset, 867 "tcp_reclen = %u\n", xprt, transport->tcp_copied,
868 transport->tcp_reclen); 868 transport->tcp_offset, transport->tcp_reclen);
869 869
870 if (transport->tcp_copied == req->rq_private_buf.buflen) 870 if (transport->tcp_copied == req->rq_private_buf.buflen)
871 transport->tcp_flags &= ~TCP_RCV_COPY_DATA; 871 transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
@@ -891,7 +891,7 @@ static inline void xs_tcp_read_discard(struct sock_xprt *transport, struct xdr_s
891 desc->count -= len; 891 desc->count -= len;
892 desc->offset += len; 892 desc->offset += len;
893 transport->tcp_offset += len; 893 transport->tcp_offset += len;
894 dprintk("RPC: discarded %Zu bytes\n", len); 894 dprintk("RPC: discarded %Zu bytes\n", len);
895 xs_tcp_check_fraghdr(transport); 895 xs_tcp_check_fraghdr(transport);
896} 896}
897 897
@@ -905,7 +905,7 @@ static int xs_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, uns
905 .count = len, 905 .count = len,
906 }; 906 };
907 907
908 dprintk("RPC: xs_tcp_data_recv started\n"); 908 dprintk("RPC: xs_tcp_data_recv started\n");
909 do { 909 do {
910 /* Read in a new fragment marker if necessary */ 910 /* Read in a new fragment marker if necessary */
911 /* Can we ever really expect to get completely empty fragments? */ 911 /* Can we ever really expect to get completely empty fragments? */
@@ -926,7 +926,7 @@ static int xs_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, uns
926 /* Skip over any trailing bytes on short reads */ 926 /* Skip over any trailing bytes on short reads */
927 xs_tcp_read_discard(transport, &desc); 927 xs_tcp_read_discard(transport, &desc);
928 } while (desc.count); 928 } while (desc.count);
929 dprintk("RPC: xs_tcp_data_recv done\n"); 929 dprintk("RPC: xs_tcp_data_recv done\n");
930 return len - desc.count; 930 return len - desc.count;
931} 931}
932 932
@@ -941,8 +941,9 @@ static void xs_tcp_data_ready(struct sock *sk, int bytes)
941 struct rpc_xprt *xprt; 941 struct rpc_xprt *xprt;
942 read_descriptor_t rd_desc; 942 read_descriptor_t rd_desc;
943 943
944 dprintk("RPC: xs_tcp_data_ready...\n");
945
944 read_lock(&sk->sk_callback_lock); 946 read_lock(&sk->sk_callback_lock);
945 dprintk("RPC: xs_tcp_data_ready...\n");
946 if (!(xprt = xprt_from_sock(sk))) 947 if (!(xprt = xprt_from_sock(sk)))
947 goto out; 948 goto out;
948 if (xprt->shutdown) 949 if (xprt->shutdown)
@@ -968,11 +969,11 @@ static void xs_tcp_state_change(struct sock *sk)
968 read_lock(&sk->sk_callback_lock); 969 read_lock(&sk->sk_callback_lock);
969 if (!(xprt = xprt_from_sock(sk))) 970 if (!(xprt = xprt_from_sock(sk)))
970 goto out; 971 goto out;
971 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); 972 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
972 dprintk("RPC: state %x conn %d dead %d zapped %d\n", 973 dprintk("RPC: state %x conn %d dead %d zapped %d\n",
973 sk->sk_state, xprt_connected(xprt), 974 sk->sk_state, xprt_connected(xprt),
974 sock_flag(sk, SOCK_DEAD), 975 sock_flag(sk, SOCK_DEAD),
975 sock_flag(sk, SOCK_ZAPPED)); 976 sock_flag(sk, SOCK_ZAPPED));
976 977
977 switch (sk->sk_state) { 978 switch (sk->sk_state) {
978 case TCP_ESTABLISHED: 979 case TCP_ESTABLISHED:
@@ -1140,7 +1141,7 @@ static void xs_set_port(struct rpc_xprt *xprt, unsigned short port)
1140{ 1141{
1141 struct sockaddr_in *sap = (struct sockaddr_in *) &xprt->addr; 1142 struct sockaddr_in *sap = (struct sockaddr_in *) &xprt->addr;
1142 1143
1143 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port); 1144 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port);
1144 1145
1145 sap->sin_port = htons(port); 1146 sap->sin_port = htons(port);
1146} 1147}
@@ -1159,7 +1160,7 @@ static int xs_bindresvport(struct sock_xprt *transport, struct socket *sock)
1159 sizeof(myaddr)); 1160 sizeof(myaddr));
1160 if (err == 0) { 1161 if (err == 0) {
1161 transport->port = port; 1162 transport->port = port;
1162 dprintk("RPC: xs_bindresvport bound to port %u\n", 1163 dprintk("RPC: xs_bindresvport bound to port %u\n",
1163 port); 1164 port);
1164 return 0; 1165 return 0;
1165 } 1166 }
@@ -1169,7 +1170,7 @@ static int xs_bindresvport(struct sock_xprt *transport, struct socket *sock)
1169 port--; 1170 port--;
1170 } while (err == -EADDRINUSE && port != transport->port); 1171 } while (err == -EADDRINUSE && port != transport->port);
1171 1172
1172 dprintk("RPC: can't bind to reserved port (%d).\n", -err); 1173 dprintk("RPC: can't bind to reserved port (%d).\n", -err);
1173 return err; 1174 return err;
1174} 1175}
1175 1176
@@ -1223,7 +1224,7 @@ static void xs_udp_connect_worker(struct work_struct *work)
1223 xs_close(xprt); 1224 xs_close(xprt);
1224 1225
1225 if ((err = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock)) < 0) { 1226 if ((err = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock)) < 0) {
1226 dprintk("RPC: can't create UDP transport socket (%d).\n", -err); 1227 dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
1227 goto out; 1228 goto out;
1228 } 1229 }
1229 xs_reclassify_socket(sock); 1230 xs_reclassify_socket(sock);
@@ -1233,7 +1234,7 @@ static void xs_udp_connect_worker(struct work_struct *work)
1233 goto out; 1234 goto out;
1234 } 1235 }
1235 1236
1236 dprintk("RPC: worker connecting xprt %p to address: %s\n", 1237 dprintk("RPC: worker connecting xprt %p to address: %s\n",
1237 xprt, xprt->address_strings[RPC_DISPLAY_ALL]); 1238 xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
1238 1239
1239 if (!transport->inet) { 1240 if (!transport->inet) {
@@ -1275,7 +1276,7 @@ static void xs_tcp_reuse_connection(struct rpc_xprt *xprt)
1275 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 1276 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
1276 struct sockaddr any; 1277 struct sockaddr any;
1277 1278
1278 dprintk("RPC: disconnecting xprt %p to reuse port\n", xprt); 1279 dprintk("RPC: disconnecting xprt %p to reuse port\n", xprt);
1279 1280
1280 /* 1281 /*
1281 * Disconnect the transport socket by doing a connect operation 1282 * Disconnect the transport socket by doing a connect operation
@@ -1285,7 +1286,7 @@ static void xs_tcp_reuse_connection(struct rpc_xprt *xprt)
1285 any.sa_family = AF_UNSPEC; 1286 any.sa_family = AF_UNSPEC;
1286 result = kernel_connect(transport->sock, &any, sizeof(any), 0); 1287 result = kernel_connect(transport->sock, &any, sizeof(any), 0);
1287 if (result) 1288 if (result)
1288 dprintk("RPC: AF_UNSPEC connect return code %d\n", 1289 dprintk("RPC: AF_UNSPEC connect return code %d\n",
1289 result); 1290 result);
1290} 1291}
1291 1292
@@ -1309,7 +1310,8 @@ static void xs_tcp_connect_worker(struct work_struct *work)
1309 if (!sock) { 1310 if (!sock) {
1310 /* start from scratch */ 1311 /* start from scratch */
1311 if ((err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock)) < 0) { 1312 if ((err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock)) < 0) {
1312 dprintk("RPC: can't create TCP transport socket (%d).\n", -err); 1313 dprintk("RPC: can't create TCP transport "
1314 "socket (%d).\n", -err);
1313 goto out; 1315 goto out;
1314 } 1316 }
1315 xs_reclassify_socket(sock); 1317 xs_reclassify_socket(sock);
@@ -1322,7 +1324,7 @@ static void xs_tcp_connect_worker(struct work_struct *work)
1322 /* "close" the socket, preserving the local port */ 1324 /* "close" the socket, preserving the local port */
1323 xs_tcp_reuse_connection(xprt); 1325 xs_tcp_reuse_connection(xprt);
1324 1326
1325 dprintk("RPC: worker connecting xprt %p to address: %s\n", 1327 dprintk("RPC: worker connecting xprt %p to address: %s\n",
1326 xprt, xprt->address_strings[RPC_DISPLAY_ALL]); 1328 xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
1327 1329
1328 if (!transport->inet) { 1330 if (!transport->inet) {
@@ -1359,8 +1361,9 @@ static void xs_tcp_connect_worker(struct work_struct *work)
1359 xprt->stat.connect_start = jiffies; 1361 xprt->stat.connect_start = jiffies;
1360 status = kernel_connect(sock, (struct sockaddr *) &xprt->addr, 1362 status = kernel_connect(sock, (struct sockaddr *) &xprt->addr,
1361 xprt->addrlen, O_NONBLOCK); 1363 xprt->addrlen, O_NONBLOCK);
1362 dprintk("RPC: %p connect status %d connected %d sock state %d\n", 1364 dprintk("RPC: %p connect status %d connected %d sock state %d\n",
1363 xprt, -status, xprt_connected(xprt), sock->sk->sk_state); 1365 xprt, -status, xprt_connected(xprt),
1366 sock->sk->sk_state);
1364 if (status < 0) { 1367 if (status < 0) {
1365 switch (status) { 1368 switch (status) {
1366 case -EINPROGRESS: 1369 case -EINPROGRESS:
@@ -1404,7 +1407,8 @@ static void xs_connect(struct rpc_task *task)
1404 return; 1407 return;
1405 1408
1406 if (transport->sock != NULL) { 1409 if (transport->sock != NULL) {
1407 dprintk("RPC: xs_connect delayed xprt %p for %lu seconds\n", 1410 dprintk("RPC: xs_connect delayed xprt %p for %lu "
1411 "seconds\n",
1408 xprt, xprt->reestablish_timeout / HZ); 1412 xprt, xprt->reestablish_timeout / HZ);
1409 schedule_delayed_work(&transport->connect_worker, 1413 schedule_delayed_work(&transport->connect_worker,
1410 xprt->reestablish_timeout); 1414 xprt->reestablish_timeout);
@@ -1412,7 +1416,7 @@ static void xs_connect(struct rpc_task *task)
1412 if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO) 1416 if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO)
1413 xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO; 1417 xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO;
1414 } else { 1418 } else {
1415 dprintk("RPC: xs_connect scheduled xprt %p\n", xprt); 1419 dprintk("RPC: xs_connect scheduled xprt %p\n", xprt);
1416 schedule_delayed_work(&transport->connect_worker, 0); 1420 schedule_delayed_work(&transport->connect_worker, 0);
1417 1421
1418 /* flush_scheduled_work can sleep... */ 1422 /* flush_scheduled_work can sleep... */
@@ -1507,13 +1511,14 @@ static struct rpc_xprt *xs_setup_xprt(struct sockaddr *addr, size_t addrlen, uns
1507 struct sock_xprt *new; 1511 struct sock_xprt *new;
1508 1512
1509 if (addrlen > sizeof(xprt->addr)) { 1513 if (addrlen > sizeof(xprt->addr)) {
1510 dprintk("RPC: xs_setup_xprt: address too large\n"); 1514 dprintk("RPC: xs_setup_xprt: address too large\n");
1511 return ERR_PTR(-EBADF); 1515 return ERR_PTR(-EBADF);
1512 } 1516 }
1513 1517
1514 new = kzalloc(sizeof(*new), GFP_KERNEL); 1518 new = kzalloc(sizeof(*new), GFP_KERNEL);
1515 if (new == NULL) { 1519 if (new == NULL) {
1516 dprintk("RPC: xs_setup_xprt: couldn't allocate rpc_xprt\n"); 1520 dprintk("RPC: xs_setup_xprt: couldn't allocate "
1521 "rpc_xprt\n");
1517 return ERR_PTR(-ENOMEM); 1522 return ERR_PTR(-ENOMEM);
1518 } 1523 }
1519 xprt = &new->xprt; 1524 xprt = &new->xprt;
@@ -1522,7 +1527,8 @@ static struct rpc_xprt *xs_setup_xprt(struct sockaddr *addr, size_t addrlen, uns
1522 xprt->slot = kcalloc(xprt->max_reqs, sizeof(struct rpc_rqst), GFP_KERNEL); 1527 xprt->slot = kcalloc(xprt->max_reqs, sizeof(struct rpc_rqst), GFP_KERNEL);
1523 if (xprt->slot == NULL) { 1528 if (xprt->slot == NULL) {
1524 kfree(xprt); 1529 kfree(xprt);
1525 dprintk("RPC: xs_setup_xprt: couldn't allocate slot table\n"); 1530 dprintk("RPC: xs_setup_xprt: couldn't allocate slot "
1531 "table\n");
1526 return ERR_PTR(-ENOMEM); 1532 return ERR_PTR(-ENOMEM);
1527 } 1533 }
1528 1534
@@ -1572,7 +1578,7 @@ struct rpc_xprt *xs_setup_udp(struct sockaddr *addr, size_t addrlen, struct rpc_
1572 xprt_set_timeout(&xprt->timeout, 5, 5 * HZ); 1578 xprt_set_timeout(&xprt->timeout, 5, 5 * HZ);
1573 1579
1574 xs_format_peer_addresses(xprt); 1580 xs_format_peer_addresses(xprt);
1575 dprintk("RPC: set up transport to address %s\n", 1581 dprintk("RPC: set up transport to address %s\n",
1576 xprt->address_strings[RPC_DISPLAY_ALL]); 1582 xprt->address_strings[RPC_DISPLAY_ALL]);
1577 1583
1578 return xprt; 1584 return xprt;
@@ -1616,7 +1622,7 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_
1616 xprt_set_timeout(&xprt->timeout, 2, 60 * HZ); 1622 xprt_set_timeout(&xprt->timeout, 2, 60 * HZ);
1617 1623
1618 xs_format_peer_addresses(xprt); 1624 xs_format_peer_addresses(xprt);
1619 dprintk("RPC: set up transport to address %s\n", 1625 dprintk("RPC: set up transport to address %s\n",
1620 xprt->address_strings[RPC_DISPLAY_ALL]); 1626 xprt->address_strings[RPC_DISPLAY_ALL]);
1621 1627
1622 return xprt; 1628 return xprt;
@@ -1629,13 +1635,8 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_
1629int init_socket_xprt(void) 1635int init_socket_xprt(void)
1630{ 1636{
1631#ifdef RPC_DEBUG 1637#ifdef RPC_DEBUG
1632 if (!sunrpc_table_header) { 1638 if (!sunrpc_table_header)
1633 sunrpc_table_header = register_sysctl_table(sunrpc_table, 1); 1639 sunrpc_table_header = register_sysctl_table(sunrpc_table);
1634#ifdef CONFIG_PROC_FS
1635 if (sunrpc_table[0].de)
1636 sunrpc_table[0].de->owner = THIS_MODULE;
1637#endif
1638 }
1639#endif 1640#endif
1640 1641
1641 return 0; 1642 return 0;