Patchwork Data corruption issue with splice() on 2.6.27.10

login
register
mail settings
Submitter Jarek Poplawski
Date Jan. 12, 2009, 1:15 p.m.
Message ID <20090112131517.GD5901@ff.dom.local>
Download mbox | patch
Permalink /patch/17933/
State RFC
Delegated to: David Miller
Headers show

Comments

Jarek Poplawski - Jan. 12, 2009, 1:15 p.m.
On Mon, Jan 12, 2009 at 11:02:57PM +1100, Herbert Xu wrote:
> On Wed, Jan 07, 2009 at 11:52:17PM +1100, Herbert Xu wrote:
> > On Wed, Jan 07, 2009 at 12:49:46PM +0000, Jarek Poplawski wrote:
> > > 
> > > Hmm... in any case: take 3
> > 
> > Yes this should fix the corruption but it kind of defeats the
> > purpose of splice by copying the data.
> 
> However, as we don't have a better fix yet, we probably should
> take Jarek's patch for now since data corruption is bad.
> 

I've wondered if something like this could work as a temporary hack?

!!! not compiled/tested !!!
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu - Jan. 12, 2009, 9:12 p.m.
On Mon, Jan 12, 2009 at 01:15:17PM +0000, Jarek Poplawski wrote:
>
> I've wondered if something like this could work as a temporary hack?

No we should fix it in skb_splice_bits because the corruption
can affect other terminations as well if a delay occurs.

Cheers,
Jarek Poplawski - Jan. 19, 2009, 7:32 a.m.
On Mon, Jan 12, 2009 at 01:15:17PM +0000, Jarek Poplawski wrote:
...
> I've wondered if something like this could work as a temporary hack?
...
> @@ -776,7 +777,8 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
>  	struct sock *sk = sock->sk;
>  
>  	if (!(sk->sk_route_caps & NETIF_F_SG) ||
> -	    !(sk->sk_route_caps & NETIF_F_ALL_CSUM))
> +	    !(sk->sk_route_caps & NETIF_F_ALL_CSUM) ||
> +	    PageSlab(page))
>  		return sock_no_sendpage(sock, page, offset, size, flags);

Just for the record: this wouldn't work yet:-( It should be probably
something like "PageCompound(compound_head(page))" test instead.

Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index ce572f9..99b0876 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -264,6 +264,7 @@ 
 #include <linux/cache.h>
 #include <linux/err.h>
 #include <linux/crypto.h>
+#include <linux/page-flags.h>
 
 #include <net/icmp.h>
 #include <net/tcp.h>
@@ -776,7 +777,8 @@  ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
 	struct sock *sk = sock->sk;
 
 	if (!(sk->sk_route_caps & NETIF_F_SG) ||
-	    !(sk->sk_route_caps & NETIF_F_ALL_CSUM))
+	    !(sk->sk_route_caps & NETIF_F_ALL_CSUM) ||
+	    PageSlab(page))
 		return sock_no_sendpage(sock, page, offset, size, flags);
 
 	lock_sock(sk);