aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-22 14:10:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-22 14:10:05 -0400
commite2f90a9141d9e1a4cd0e79716919a5fa39684ae9 (patch)
tree2a61c5286b7e0d83e2c6a62d9b39e6ab33b1ff08
parent0864a4e201b1ea442f4c8b887418a29f67e24d30 (diff)
parent19e6454ca778e11e81497bd87c930dc0defd03d7 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [AF_RXRPC]: Return the number of bytes buffered in rxrpc_send_data() [IPVS]: Fix state variable on failure to start ipvs threads [XFRM]: Fix MTU calculation for non-ESP SAs
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c41
-rw-r--r--net/rxrpc/ar-output.c5
-rw-r--r--net/xfrm/xfrm_state.c2
3 files changed, 44 insertions, 4 deletions
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index 7ea2d981a932..356f067484e3 100644
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -67,6 +67,11 @@ struct ip_vs_sync_conn_options {
67 struct ip_vs_seq out_seq; /* outgoing seq. struct */ 67 struct ip_vs_seq out_seq; /* outgoing seq. struct */
68}; 68};
69 69
70struct ip_vs_sync_thread_data {
71 struct completion *startup;
72 int state;
73};
74
70#define IP_VS_SYNC_CONN_TIMEOUT (3*60*HZ) 75#define IP_VS_SYNC_CONN_TIMEOUT (3*60*HZ)
71#define SIMPLE_CONN_SIZE (sizeof(struct ip_vs_sync_conn)) 76#define SIMPLE_CONN_SIZE (sizeof(struct ip_vs_sync_conn))
72#define FULL_CONN_SIZE \ 77#define FULL_CONN_SIZE \
@@ -751,6 +756,7 @@ static int sync_thread(void *startup)
751 mm_segment_t oldmm; 756 mm_segment_t oldmm;
752 int state; 757 int state;
753 const char *name; 758 const char *name;
759 struct ip_vs_sync_thread_data *tinfo = startup;
754 760
755 /* increase the module use count */ 761 /* increase the module use count */
756 ip_vs_use_count_inc(); 762 ip_vs_use_count_inc();
@@ -789,7 +795,14 @@ static int sync_thread(void *startup)
789 add_wait_queue(&sync_wait, &wait); 795 add_wait_queue(&sync_wait, &wait);
790 796
791 set_sync_pid(state, current->pid); 797 set_sync_pid(state, current->pid);
792 complete((struct completion *)startup); 798 complete(tinfo->startup);
799
800 /*
801 * once we call the completion queue above, we should
802 * null out that reference, since its allocated on the
803 * stack of the creating kernel thread
804 */
805 tinfo->startup = NULL;
793 806
794 /* processing master/backup loop here */ 807 /* processing master/backup loop here */
795 if (state == IP_VS_STATE_MASTER) 808 if (state == IP_VS_STATE_MASTER)
@@ -801,6 +814,14 @@ static int sync_thread(void *startup)
801 remove_wait_queue(&sync_wait, &wait); 814 remove_wait_queue(&sync_wait, &wait);
802 815
803 /* thread exits */ 816 /* thread exits */
817
818 /*
819 * If we weren't explicitly stopped, then we
820 * exited in error, and should undo our state
821 */
822 if ((!stop_master_sync) && (!stop_backup_sync))
823 ip_vs_sync_state -= tinfo->state;
824
804 set_sync_pid(state, 0); 825 set_sync_pid(state, 0);
805 IP_VS_INFO("sync thread stopped!\n"); 826 IP_VS_INFO("sync thread stopped!\n");
806 827
@@ -812,6 +833,11 @@ static int sync_thread(void *startup)
812 set_stop_sync(state, 0); 833 set_stop_sync(state, 0);
813 wake_up(&stop_sync_wait); 834 wake_up(&stop_sync_wait);
814 835
836 /*
837 * we need to free the structure that was allocated
838 * for us in start_sync_thread
839 */
840 kfree(tinfo);
815 return 0; 841 return 0;
816} 842}
817 843
@@ -838,11 +864,19 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid)
838{ 864{
839 DECLARE_COMPLETION_ONSTACK(startup); 865 DECLARE_COMPLETION_ONSTACK(startup);
840 pid_t pid; 866 pid_t pid;
867 struct ip_vs_sync_thread_data *tinfo;
841 868
842 if ((state == IP_VS_STATE_MASTER && sync_master_pid) || 869 if ((state == IP_VS_STATE_MASTER && sync_master_pid) ||
843 (state == IP_VS_STATE_BACKUP && sync_backup_pid)) 870 (state == IP_VS_STATE_BACKUP && sync_backup_pid))
844 return -EEXIST; 871 return -EEXIST;
845 872
873 /*
874 * Note that tinfo will be freed in sync_thread on exit
875 */
876 tinfo = kmalloc(sizeof(struct ip_vs_sync_thread_data), GFP_KERNEL);
877 if (!tinfo)
878 return -ENOMEM;
879
846 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid); 880 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
847 IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n", 881 IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n",
848 sizeof(struct ip_vs_sync_conn)); 882 sizeof(struct ip_vs_sync_conn));
@@ -858,8 +892,11 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid)
858 ip_vs_backup_syncid = syncid; 892 ip_vs_backup_syncid = syncid;
859 } 893 }
860 894
895 tinfo->state = state;
896 tinfo->startup = &startup;
897
861 repeat: 898 repeat:
862 if ((pid = kernel_thread(fork_sync_thread, &startup, 0)) < 0) { 899 if ((pid = kernel_thread(fork_sync_thread, tinfo, 0)) < 0) {
863 IP_VS_ERR("could not create fork_sync_thread due to %d... " 900 IP_VS_ERR("could not create fork_sync_thread due to %d... "
864 "retrying.\n", pid); 901 "retrying.\n", pid);
865 msleep_interruptible(1000); 902 msleep_interruptible(1000);
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c
index 591c4422205e..cc9102c5b588 100644
--- a/net/rxrpc/ar-output.c
+++ b/net/rxrpc/ar-output.c
@@ -640,6 +640,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
640 goto efault; 640 goto efault;
641 sp->remain -= copy; 641 sp->remain -= copy;
642 skb->mark += copy; 642 skb->mark += copy;
643 copied += copy;
643 644
644 len -= copy; 645 len -= copy;
645 segment -= copy; 646 segment -= copy;
@@ -709,6 +710,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
709 710
710 } while (segment > 0); 711 } while (segment > 0);
711 712
713success:
714 ret = copied;
712out: 715out:
713 call->tx_pending = skb; 716 call->tx_pending = skb;
714 _leave(" = %d", ret); 717 _leave(" = %d", ret);
@@ -725,7 +728,7 @@ call_aborted:
725 728
726maybe_error: 729maybe_error:
727 if (copied) 730 if (copied)
728 ret = copied; 731 goto success;
729 goto out; 732 goto out;
730 733
731efault: 734efault:
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 85f3f43a6cca..dfacb9c2a6e3 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1729,7 +1729,7 @@ int xfrm_state_mtu(struct xfrm_state *x, int mtu)
1729 x->type && x->type->get_mtu) 1729 x->type && x->type->get_mtu)
1730 res = x->type->get_mtu(x, mtu); 1730 res = x->type->get_mtu(x, mtu);
1731 else 1731 else
1732 res = mtu; 1732 res = mtu - x->props.header_len;
1733 spin_unlock_bh(&x->lock); 1733 spin_unlock_bh(&x->lock);
1734 return res; 1734 return res;
1735} 1735}