Re: splice lost data

From: Vegard Nossum
Date: Wed Apr 08 2009 - 03:20:53 EST


2009/4/7 xinglp <xinglp@xxxxxxxxx>:
> 2.6.29.1 in VM
>
> When recv data more than 8K (1024*8) bytes at once, data lost happen.
>

Don't know if this is related to the problem you report, but your code is buggy.

You're checking errno before you know that splice() returned -1. Now,
I don't know the actual implementation, but as with most system calls,
the interface specifies only that errno is updated when the function
returns -1:

"On error, splice() returns -1 and errno is set to indicate the
error." (man 2 splice)

You're also not checking explicitly for the return value 0, which
would possibly also not set errno (i.e. you're using perror() in the
case where splice() returned 0).

Please let me know if this fixes your problem!


Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/