diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-08-07 06:38:41 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-07 06:38:41 -0400 |
commit | 242898be7a1921f646ca529ddc26d7337c69922f (patch) | |
tree | 674adf64ca6254318dab5bcd428ebe8ac73957ff /net | |
parent | 6bbad18a8b18228fa65d73547dfd5efad1515ef8 (diff) | |
parent | 9f737633e6ee54fc174282d49b2559bd2208391d (diff) |
Merge branch 'master' into upstream
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_netlink.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 3 | ||||
-rw-r--r-- | net/lapb/lapb_iface.c | 12 | ||||
-rw-r--r-- | net/llc/af_llc.c | 20 | ||||
-rw-r--r-- | net/llc/llc_sap.c | 4 | ||||
-rw-r--r-- | net/sched/sch_api.c | 2 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 6 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 52 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 6 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 21 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 29 |
11 files changed, 90 insertions, 67 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 06abb6634f5b..53086fb75089 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -85,7 +85,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port) | |||
85 | goto err_out; | 85 | goto err_out; |
86 | 86 | ||
87 | err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0); | 87 | err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0); |
88 | if (err) | 88 | if (err < 0) |
89 | goto err_kfree; | 89 | goto err_kfree; |
90 | 90 | ||
91 | NETLINK_CB(skb).dst_group = RTNLGRP_LINK; | 91 | NETLINK_CB(skb).dst_group = RTNLGRP_LINK; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 738dad9f7d49..104af5d5bcbc 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3541,7 +3541,8 @@ void tcp_cwnd_application_limited(struct sock *sk) | |||
3541 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && | 3541 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && |
3542 | sk->sk_socket && !test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { | 3542 | sk->sk_socket && !test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { |
3543 | /* Limited by application or receiver window. */ | 3543 | /* Limited by application or receiver window. */ |
3544 | u32 win_used = max(tp->snd_cwnd_used, 2U); | 3544 | u32 init_win = tcp_init_cwnd(tp, __sk_dst_get(sk)); |
3545 | u32 win_used = max(tp->snd_cwnd_used, init_win); | ||
3545 | if (win_used < tp->snd_cwnd) { | 3546 | if (win_used < tp->snd_cwnd) { |
3546 | tp->snd_ssthresh = tcp_current_ssthresh(sk); | 3547 | tp->snd_ssthresh = tcp_current_ssthresh(sk); |
3547 | tp->snd_cwnd = (tp->snd_cwnd + win_used) >> 1; | 3548 | tp->snd_cwnd = (tp->snd_cwnd + win_used) >> 1; |
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index d504eed416f6..7e6bc41eeb21 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c | |||
@@ -238,11 +238,13 @@ int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms) | |||
238 | goto out_put; | 238 | goto out_put; |
239 | 239 | ||
240 | if (lapb->state == LAPB_STATE_0) { | 240 | if (lapb->state == LAPB_STATE_0) { |
241 | if (((parms->mode & LAPB_EXTENDED) && | 241 | if (parms->mode & LAPB_EXTENDED) { |
242 | (parms->window < 1 || parms->window > 127)) || | 242 | if (parms->window < 1 || parms->window > 127) |
243 | (parms->window < 1 || parms->window > 7)) | 243 | goto out_put; |
244 | goto out_put; | 244 | } else { |
245 | 245 | if (parms->window < 1 || parms->window > 7) | |
246 | goto out_put; | ||
247 | } | ||
246 | lapb->mode = parms->mode; | 248 | lapb->mode = parms->mode; |
247 | lapb->window = parms->window; | 249 | lapb->window = parms->window; |
248 | } | 250 | } |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index d6cfe84d521b..2652ead96c64 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -784,24 +784,20 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
784 | copied += used; | 784 | copied += used; |
785 | len -= used; | 785 | len -= used; |
786 | 786 | ||
787 | if (used + offset < skb->len) | ||
788 | continue; | ||
789 | |||
790 | if (!(flags & MSG_PEEK)) { | 787 | if (!(flags & MSG_PEEK)) { |
791 | sk_eat_skb(sk, skb, 0); | 788 | sk_eat_skb(sk, skb, 0); |
792 | *seq = 0; | 789 | *seq = 0; |
793 | } | 790 | } |
791 | |||
792 | /* For non stream protcols we get one packet per recvmsg call */ | ||
793 | if (sk->sk_type != SOCK_STREAM) | ||
794 | goto copy_uaddr; | ||
795 | |||
796 | /* Partial read */ | ||
797 | if (used + offset < skb->len) | ||
798 | continue; | ||
794 | } while (len > 0); | 799 | } while (len > 0); |
795 | 800 | ||
796 | /* | ||
797 | * According to UNIX98, msg_name/msg_namelen are ignored | ||
798 | * on connected socket. -ANK | ||
799 | * But... af_llc still doesn't have separate sets of methods for | ||
800 | * SOCK_DGRAM and SOCK_STREAM :-( So we have to do this test, will | ||
801 | * eventually fix this tho :-) -acme | ||
802 | */ | ||
803 | if (sk->sk_type == SOCK_DGRAM) | ||
804 | goto copy_uaddr; | ||
805 | out: | 801 | out: |
806 | release_sock(sk); | 802 | release_sock(sk); |
807 | return copied; | 803 | return copied; |
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 20c4eb5c1ac6..42eb0c3a9780 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c | |||
@@ -51,10 +51,10 @@ void llc_save_primitive(struct sock *sk, struct sk_buff* skb, u8 prim) | |||
51 | { | 51 | { |
52 | struct sockaddr_llc *addr; | 52 | struct sockaddr_llc *addr; |
53 | 53 | ||
54 | if (skb->sk->sk_type == SOCK_STREAM) /* See UNIX98 */ | ||
55 | return; | ||
56 | /* save primitive for use by the user. */ | 54 | /* save primitive for use by the user. */ |
57 | addr = llc_ui_skb_cb(skb); | 55 | addr = llc_ui_skb_cb(skb); |
56 | |||
57 | memset(addr, 0, sizeof(*addr)); | ||
58 | addr->sllc_family = sk->sk_family; | 58 | addr->sllc_family = sk->sk_family; |
59 | addr->sllc_arphrd = skb->dev->type; | 59 | addr->sllc_arphrd = skb->dev->type; |
60 | addr->sllc_test = prim == LLC_TEST_PRIM; | 60 | addr->sllc_test = prim == LLC_TEST_PRIM; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index c7844bacbbcb..a19eff12cf78 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -430,7 +430,7 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | |||
430 | } | 430 | } |
431 | #endif | 431 | #endif |
432 | 432 | ||
433 | err = -EINVAL; | 433 | err = -ENOENT; |
434 | if (ops == NULL) | 434 | if (ops == NULL) |
435 | goto err_out; | 435 | goto err_out; |
436 | 436 | ||
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 7026b0866b7b..00cb388ece03 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -71,7 +71,12 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, | |||
71 | new = detail->alloc(); | 71 | new = detail->alloc(); |
72 | if (!new) | 72 | if (!new) |
73 | return NULL; | 73 | return NULL; |
74 | /* must fully initialise 'new', else | ||
75 | * we might get lose if we need to | ||
76 | * cache_put it soon. | ||
77 | */ | ||
74 | cache_init(new); | 78 | cache_init(new); |
79 | detail->init(new, key); | ||
75 | 80 | ||
76 | write_lock(&detail->hash_lock); | 81 | write_lock(&detail->hash_lock); |
77 | 82 | ||
@@ -85,7 +90,6 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, | |||
85 | return tmp; | 90 | return tmp; |
86 | } | 91 | } |
87 | } | 92 | } |
88 | detail->init(new, key); | ||
89 | new->next = *head; | 93 | new->next = *head; |
90 | *head = new; | 94 | *head = new; |
91 | detail->entries++; | 95 | detail->entries++; |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4ba271f892c8..d6409e757219 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -921,26 +921,43 @@ call_transmit(struct rpc_task *task) | |||
921 | task->tk_status = xprt_prepare_transmit(task); | 921 | task->tk_status = xprt_prepare_transmit(task); |
922 | if (task->tk_status != 0) | 922 | if (task->tk_status != 0) |
923 | return; | 923 | return; |
924 | task->tk_action = call_transmit_status; | ||
924 | /* Encode here so that rpcsec_gss can use correct sequence number. */ | 925 | /* Encode here so that rpcsec_gss can use correct sequence number. */ |
925 | if (rpc_task_need_encode(task)) { | 926 | if (rpc_task_need_encode(task)) { |
926 | task->tk_rqstp->rq_bytes_sent = 0; | 927 | BUG_ON(task->tk_rqstp->rq_bytes_sent != 0); |
927 | call_encode(task); | 928 | call_encode(task); |
928 | /* Did the encode result in an error condition? */ | 929 | /* Did the encode result in an error condition? */ |
929 | if (task->tk_status != 0) | 930 | if (task->tk_status != 0) |
930 | goto out_nosend; | 931 | return; |
931 | } | 932 | } |
932 | task->tk_action = call_transmit_status; | ||
933 | xprt_transmit(task); | 933 | xprt_transmit(task); |
934 | if (task->tk_status < 0) | 934 | if (task->tk_status < 0) |
935 | return; | 935 | return; |
936 | if (!task->tk_msg.rpc_proc->p_decode) { | 936 | /* |
937 | task->tk_action = rpc_exit_task; | 937 | * On success, ensure that we call xprt_end_transmit() before sleeping |
938 | rpc_wake_up_task(task); | 938 | * in order to allow access to the socket to other RPC requests. |
939 | } | 939 | */ |
940 | return; | 940 | call_transmit_status(task); |
941 | out_nosend: | 941 | if (task->tk_msg.rpc_proc->p_decode != NULL) |
942 | /* release socket write lock before attempting to handle error */ | 942 | return; |
943 | xprt_abort_transmit(task); | 943 | task->tk_action = rpc_exit_task; |
944 | rpc_wake_up_task(task); | ||
945 | } | ||
946 | |||
947 | /* | ||
948 | * 5a. Handle cleanup after a transmission | ||
949 | */ | ||
950 | static void | ||
951 | call_transmit_status(struct rpc_task *task) | ||
952 | { | ||
953 | task->tk_action = call_status; | ||
954 | /* | ||
955 | * Special case: if we've been waiting on the socket's write_space() | ||
956 | * callback, then don't call xprt_end_transmit(). | ||
957 | */ | ||
958 | if (task->tk_status == -EAGAIN) | ||
959 | return; | ||
960 | xprt_end_transmit(task); | ||
944 | rpc_task_force_reencode(task); | 961 | rpc_task_force_reencode(task); |
945 | } | 962 | } |
946 | 963 | ||
@@ -992,18 +1009,7 @@ call_status(struct rpc_task *task) | |||
992 | } | 1009 | } |
993 | 1010 | ||
994 | /* | 1011 | /* |
995 | * 6a. Handle transmission errors. | 1012 | * 6a. Handle RPC timeout |
996 | */ | ||
997 | static void | ||
998 | call_transmit_status(struct rpc_task *task) | ||
999 | { | ||
1000 | if (task->tk_status != -EAGAIN) | ||
1001 | rpc_task_force_reencode(task); | ||
1002 | call_status(task); | ||
1003 | } | ||
1004 | |||
1005 | /* | ||
1006 | * 6b. Handle RPC timeout | ||
1007 | * We do not release the request slot, so we keep using the | 1013 | * We do not release the request slot, so we keep using the |
1008 | * same XID for all retransmits. | 1014 | * same XID for all retransmits. |
1009 | */ | 1015 | */ |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index dc6cb93c8830..a3bd2db2e024 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -667,10 +667,11 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client) | |||
667 | RPCAUTH_info, RPCAUTH_EOF); | 667 | RPCAUTH_info, RPCAUTH_EOF); |
668 | if (error) | 668 | if (error) |
669 | goto err_depopulate; | 669 | goto err_depopulate; |
670 | dget(dentry); | ||
670 | out: | 671 | out: |
671 | mutex_unlock(&dir->i_mutex); | 672 | mutex_unlock(&dir->i_mutex); |
672 | rpc_release_path(&nd); | 673 | rpc_release_path(&nd); |
673 | return dget(dentry); | 674 | return dentry; |
674 | err_depopulate: | 675 | err_depopulate: |
675 | rpc_depopulate(dentry); | 676 | rpc_depopulate(dentry); |
676 | __rpc_rmdir(dir, dentry); | 677 | __rpc_rmdir(dir, dentry); |
@@ -731,10 +732,11 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) | |||
731 | rpci->flags = flags; | 732 | rpci->flags = flags; |
732 | rpci->ops = ops; | 733 | rpci->ops = ops; |
733 | inode_dir_notify(dir, DN_CREATE); | 734 | inode_dir_notify(dir, DN_CREATE); |
735 | dget(dentry); | ||
734 | out: | 736 | out: |
735 | mutex_unlock(&dir->i_mutex); | 737 | mutex_unlock(&dir->i_mutex); |
736 | rpc_release_path(&nd); | 738 | rpc_release_path(&nd); |
737 | return dget(dentry); | 739 | return dentry; |
738 | err_dput: | 740 | err_dput: |
739 | dput(dentry); | 741 | dput(dentry); |
740 | dentry = ERR_PTR(-ENOMEM); | 742 | dentry = ERR_PTR(-ENOMEM); |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 313b68d892c6..e8c2bc4977f3 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -707,12 +707,9 @@ out_unlock: | |||
707 | return err; | 707 | return err; |
708 | } | 708 | } |
709 | 709 | ||
710 | void | 710 | void xprt_end_transmit(struct rpc_task *task) |
711 | xprt_abort_transmit(struct rpc_task *task) | ||
712 | { | 711 | { |
713 | struct rpc_xprt *xprt = task->tk_xprt; | 712 | xprt_release_write(task->tk_xprt, task); |
714 | |||
715 | xprt_release_write(xprt, task); | ||
716 | } | 713 | } |
717 | 714 | ||
718 | /** | 715 | /** |
@@ -761,8 +758,6 @@ void xprt_transmit(struct rpc_task *task) | |||
761 | task->tk_status = -ENOTCONN; | 758 | task->tk_status = -ENOTCONN; |
762 | else if (!req->rq_received) | 759 | else if (!req->rq_received) |
763 | rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); | 760 | rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); |
764 | |||
765 | xprt->ops->release_xprt(xprt, task); | ||
766 | spin_unlock_bh(&xprt->transport_lock); | 761 | spin_unlock_bh(&xprt->transport_lock); |
767 | return; | 762 | return; |
768 | } | 763 | } |
@@ -772,18 +767,8 @@ void xprt_transmit(struct rpc_task *task) | |||
772 | * schedq, and being picked up by a parallel run of rpciod(). | 767 | * schedq, and being picked up by a parallel run of rpciod(). |
773 | */ | 768 | */ |
774 | task->tk_status = status; | 769 | task->tk_status = status; |
775 | 770 | if (status == -ECONNREFUSED) | |
776 | switch (status) { | ||
777 | case -ECONNREFUSED: | ||
778 | rpc_sleep_on(&xprt->sending, task, NULL, NULL); | 771 | rpc_sleep_on(&xprt->sending, task, NULL, NULL); |
779 | case -EAGAIN: | ||
780 | case -ENOTCONN: | ||
781 | return; | ||
782 | default: | ||
783 | break; | ||
784 | } | ||
785 | xprt_release_write(xprt, task); | ||
786 | return; | ||
787 | } | 772 | } |
788 | 773 | ||
789 | static inline void do_xprt_reserve(struct rpc_task *task) | 774 | static inline void do_xprt_reserve(struct rpc_task *task) |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index ee678ed13b6f..441bd53f5eca 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -414,6 +414,33 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
414 | } | 414 | } |
415 | 415 | ||
416 | /** | 416 | /** |
417 | * xs_tcp_release_xprt - clean up after a tcp transmission | ||
418 | * @xprt: transport | ||
419 | * @task: rpc task | ||
420 | * | ||
421 | * This cleans up if an error causes us to abort the transmission of a request. | ||
422 | * In this case, the socket may need to be reset in order to avoid confusing | ||
423 | * the server. | ||
424 | */ | ||
425 | static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) | ||
426 | { | ||
427 | struct rpc_rqst *req; | ||
428 | |||
429 | if (task != xprt->snd_task) | ||
430 | return; | ||
431 | if (task == NULL) | ||
432 | goto out_release; | ||
433 | req = task->tk_rqstp; | ||
434 | if (req->rq_bytes_sent == 0) | ||
435 | goto out_release; | ||
436 | if (req->rq_bytes_sent == req->rq_snd_buf.len) | ||
437 | goto out_release; | ||
438 | set_bit(XPRT_CLOSE_WAIT, &task->tk_xprt->state); | ||
439 | out_release: | ||
440 | xprt_release_xprt(xprt, task); | ||
441 | } | ||
442 | |||
443 | /** | ||
417 | * xs_close - close a socket | 444 | * xs_close - close a socket |
418 | * @xprt: transport | 445 | * @xprt: transport |
419 | * | 446 | * |
@@ -1250,7 +1277,7 @@ static struct rpc_xprt_ops xs_udp_ops = { | |||
1250 | 1277 | ||
1251 | static struct rpc_xprt_ops xs_tcp_ops = { | 1278 | static struct rpc_xprt_ops xs_tcp_ops = { |
1252 | .reserve_xprt = xprt_reserve_xprt, | 1279 | .reserve_xprt = xprt_reserve_xprt, |
1253 | .release_xprt = xprt_release_xprt, | 1280 | .release_xprt = xs_tcp_release_xprt, |
1254 | .set_port = xs_set_port, | 1281 | .set_port = xs_set_port, |
1255 | .connect = xs_connect, | 1282 | .connect = xs_connect, |
1256 | .buf_alloc = rpc_malloc, | 1283 | .buf_alloc = rpc_malloc, |