1 |
On Sun, May 14, 2017 at 6:31 AM, Brian Dolbec <dolsen@g.o> wrote: |
2 |
|
3 |
> On Tue, 9 May 2017 23:59:34 -0700 |
4 |
> Zac Medico <zmedico@g.o> wrote: |
5 |
> |
6 |
> > Fix the lseek offset for the plain read/write loop to account |
7 |
> > for buffered data that has not been written to to the output |
8 |
> > file yet (due to previous interruption by EINTR). This code |
9 |
> > only affects Linux 2.6.32 and earlier (newer kernels use |
10 |
> > copy_file_range or sendfile). |
11 |
> > |
12 |
> > X-Gentoo-bug: 618086 |
13 |
> > X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=618086 |
14 |
> > --- |
15 |
> > src/portage_util_file_copy_reflink_linux.c | 13 ++++++++----- |
16 |
> > 1 file changed, 8 insertions(+), 5 deletions(-) |
17 |
> > |
18 |
> > diff --git a/src/portage_util_file_copy_reflink_linux.c |
19 |
> > b/src/portage_util_file_copy_reflink_linux.c index 2fb17a0..4be9e05 |
20 |
> > 100644 --- a/src/portage_util_file_copy_reflink_linux.c |
21 |
> > +++ b/src/portage_util_file_copy_reflink_linux.c |
22 |
> > @@ -323,12 +323,14 @@ _reflink_linux_file_copy(PyObject *self, |
23 |
> > PyObject *args) if (buf == NULL) { |
24 |
> > error = errno; |
25 |
> > |
26 |
> > - /* For the read call, the fd_in file offset must be |
27 |
> > - * exactly equal to offset_out. Use lseek to ensure |
28 |
> > - * correct state, in case an EINTR retry caused it to |
29 |
> > - * get out of sync somewhow. |
30 |
> > + /* For the read call, the fd_in file offset must be |
31 |
> > exactly |
32 |
> > + * equal to offset_out + buf_bytes, where buf_bytes |
33 |
> > is the |
34 |
> > + * amount of buffered data that has not been written |
35 |
> > to |
36 |
> > + * to the output file yet. Use lseek to ensure |
37 |
> > correct state, |
38 |
> > + * in case an EINTR retry caused it to get out of |
39 |
> > sync |
40 |
> > + * somewhow. |
41 |
> > */ |
42 |
> > - } else if (lseek(fd_in, offset_out, SEEK_SET) < 0) { |
43 |
> > + } else if (lseek(fd_in, offset_out + buf_bytes, |
44 |
> > SEEK_SET) < 0) { error = errno; |
45 |
> > } else { |
46 |
> > while (1) { |
47 |
> > @@ -345,6 +347,7 @@ _reflink_linux_file_copy(PyObject *self, PyObject |
48 |
> > *args) |
49 |
> > } else if (buf_bytes < 0) { |
50 |
> > error = errno; |
51 |
> > + buf_bytes = 0; |
52 |
> > break; |
53 |
> > } |
54 |
> > } |
55 |
> |
56 |
> looks fine :) |
57 |
> |
58 |
|
59 |
Thanks, merged: |
60 |
|
61 |
https://gitweb.gentoo.org/proj/portage.git/commit/?id=a3c87da25dc1944e6b7720e304318ae5474dff95 |
62 |
-- |
63 |
Thanks, |
64 |
Zac |