Bug 8679 - recvfile code path using splice() on Linux leaves data in the pipe on short write.
Summary: recvfile code path using splice() on Linux leaves data in the pipe on short w...
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks: 8595
  Show dependency treegraph
 
Reported: 2011-12-25 05:01 UTC by Jeremy Allison
Modified: 2012-06-06 12:27 UTC (History)
0 users

See Also:


Attachments
git am fix for 3.6.x and 3.5.x. (988 bytes, patch)
2011-12-31 02:01 UTC, Jeremy Allison
no flags Details
git-am fix for 3.5.x and 3.6.x. (6.39 KB, patch)
2012-01-03 19:36 UTC, Jeremy Allison
abartlet: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2011-12-25 05:01:42 UTC
Reported by Andrew Bartlett:

> In particular, I'm thinking
>
> if (total_written < count) {
> 
> is not the correct test for draining the socket.  Why does draining the
> socket have anything to do with total_written?  Shouldn't it be:
> 
> if (count) {
> 
> That is, during a multi-part recvfile of 48k of data (due to the 16k
> chunks) I think that we could get a pattern like:
> 
> count = 48000
> total_written = 0
> 
> nread = 16000
> 
> end loop 1:
> total_written = 16000
> count = 32000
> 
> error:
> total_written is < count
> drain 16000 from fromfd, leaving 16000 in fromfd
> 
> or 
> 
> start loop 2:
> nread = 16000
> total_written = 32000
> count = 16000
> 
> error:
> 
> total_written is > count
> no drain, but 16000 still in fromfd

Patch to follow. This is a problem in 3.6.x and also 3.5.x.
Comment 1 Jeremy Allison 2011-12-31 02:01:00 UTC
Created attachment 7217 [details]
git am fix for 3.6.x and 3.5.x.
Comment 2 Jeremy Allison 2011-12-31 05:13:22 UTC
Comment on attachment 7217 [details]
git am fix for 3.6.x and 3.5.x.

Canceling this review as the patchset isn't yet complete.
Comment 3 Jeremy Allison 2012-01-03 19:36:32 UTC
Created attachment 7223 [details]
git-am fix for 3.5.x and 3.6.x.

Full patch fixing all issues. Has gone into master.
Comment 4 Andrew Bartlett 2012-01-03 23:56:12 UTC
Comment on attachment 7223 [details]
git-am fix for 3.5.x and 3.6.x.

Tested with the sparc recvfile patch and a full filesystem on 3.5.11
Comment 5 Jeremy Allison 2012-01-04 00:03:50 UTC
Re-assigning to Karolin for inclusion in 3.5.next and 3.6.next.
Jeremy.
Comment 6 Karolin Seeger 2012-01-04 20:32:58 UTC
Pushed to v3-5-test and v3-6-test.
Closing out bug report.

Thanks!