The branch, master has been updated
       via  9c7d755 Flush write buffer on an aborted in-place transfer.
      from  60cc5d4 Mention latest news.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9c7d755dfe9ebfe7f7c53b63c047bae267de7272
Author: Wayne Davison <way...@samba.org>
Date:   Sat Sep 28 10:11:35 2013 -0700

    Flush write buffer on an aborted in-place transfer.

-----------------------------------------------------------------------

Summary of changes:
 NEWS       |   17 +++++++++++------
 cleanup.c  |   32 +++++++++++++++++++-------------
 receiver.c |    3 ++-
 3 files changed, 32 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/NEWS b/NEWS
index ce40271..a034ade 100644
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,11 @@ Changes since 3.0.9:
     - When creating a temp-file, rsync is now a bit smarter about it dot-char
       choices, which can fix a problem on OS X with names that start with "..".
 
+    - Rsync now sets a cleanup flag for --inplace and --append transfers that
+      will flush the write buffer if the transfer aborts.  This ensures that
+      more received data gets written out to the disk on an aborted transfer
+      (which is quite helpful on a slow, flaky connection).
+
     - The reads that map_ptr() now does are aligned on 1K boundaries.  This
       helps some filesystems and/or files that don't like unaligned reads.
 
@@ -158,19 +163,19 @@ Changes since 3.0.9:
       how to make this even easier to install & use are welcomed.)
 
     - Improved the speed of some --inplace updates when there are lots of
-      identical checksum blocks that end up being unsuable.
+      identical checksum blocks that end up being unusable.
 
-    - Added the --outbuf=N|L|B option for chosing the output buffering.
+    - Added the --outbuf=N|L|B option for choosing the output buffering.
 
-    - Repating the --fuzzy option now causes the code to look for fuzzy matches
-      inside alt-dest directories too.
+    - Repeating the --fuzzy option now causes the code to look for fuzzy
+      matches inside alt-dest directories too.
 
     - The --chmod option now supports numeric modes, e.g. --chmod=644,D755
 
     - Added some Solaris xattr code.
 
     - Made an rsync daemon (the listening process) exit with a 0 status when
-      it was signalled to die.  This helps launchd.
+      it was signaled to die.  This helps launchd.
 
     - Improved the RSYNC_* environment variables for the pre-xfer exec script:
       when a daemon is sent multiple request args, they are now joined into a
@@ -211,7 +216,7 @@ Changes since 3.0.9:
     - A daemon can now inform a client about a daemon-configured timeout value
       so that the client can assist in the keep-alive activity (protocol 31).
 
-    - The filter code received some refactoring to make it more extendable, to
+    - The filter code received some refactoring to make it more extendible, to
       read better, and do better sanity checking.
 
     - Really big numbers are now output using our own big-num routine rather
diff --git a/cleanup.c b/cleanup.c
index d84abb5..c750ba6 100644
--- a/cleanup.c
+++ b/cleanup.c
@@ -87,7 +87,7 @@ int cleanup_got_literal = 0;
 static const char *cleanup_fname;
 static const char *cleanup_new_fname;
 static struct file_struct *cleanup_file;
-static int cleanup_fd_r, cleanup_fd_w;
+static int cleanup_fd_r = -1, cleanup_fd_w = -1;
 static pid_t cleanup_pid = 0;
 
 pid_t cleanup_child_pid = -1;
@@ -155,26 +155,31 @@ NORETURN void _exit_cleanup(int code, const char *file, 
int line)
 #include "case_N.h"
                switch_step++;
 
-               if (cleanup_got_literal && cleanup_fname && cleanup_new_fname
-                && keep_partial && handle_partial_dir(cleanup_new_fname, 
PDIR_CREATE)) {
-                       int tweak_modtime = 0;
+               if (cleanup_got_literal && (cleanup_fname || cleanup_fd_w != 
-1)) {
                        const char *fname = cleanup_fname;
                        cleanup_fname = NULL;
-                       if (cleanup_fd_r != -1)
+                       if (cleanup_fd_r != -1) {
                                close(cleanup_fd_r);
+                               cleanup_fd_r = -1;
+                       }
                        if (cleanup_fd_w != -1) {
                                flush_write_file(cleanup_fd_w);
                                close(cleanup_fd_w);
+                               cleanup_fd_w = -1;
                        }
-                       if (!partial_dir) {
-                           /* We don't want to leave a partial file with a 
modern time or it
-                            * could be skipped via --update.  Setting the time 
to something
-                            * really old also helps it to stand out as 
unfinished in an ls. */
-                           tweak_modtime = 1;
-                           cleanup_file->modtime = 0;
+                       if (fname && cleanup_new_fname && keep_partial
+                        && handle_partial_dir(cleanup_new_fname, PDIR_CREATE)) 
{
+                               int tweak_modtime = 0;
+                               if (!partial_dir) {
+                                   /* We don't want to leave a partial file 
with a modern time or it
+                                    * could be skipped via --update.  Setting 
the time to something
+                                    * really old also helps it to stand out as 
unfinished in an ls. */
+                                   tweak_modtime = 1;
+                                   cleanup_file->modtime = 0;
+                               }
+                               finish_transfer(cleanup_new_fname, fname, NULL, 
NULL,
+                                               cleanup_file, tweak_modtime, 
!partial_dir);
                        }
-                       finish_transfer(cleanup_new_fname, fname, NULL, NULL,
-                                       cleanup_file, tweak_modtime, 
!partial_dir);
                }
 
                /* FALLTHROUGH */
@@ -266,6 +271,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int 
line)
 void cleanup_disable(void)
 {
        cleanup_fname = cleanup_new_fname = NULL;
+       cleanup_fd_r = cleanup_fd_w = -1;
        cleanup_got_literal = 0;
 }
 
diff --git a/receiver.c b/receiver.c
index 622f462..1e064d9 100644
--- a/receiver.c
+++ b/receiver.c
@@ -819,7 +819,8 @@ int recv_files(int f_in, int f_out, char *local_name)
                        if (fd2 == -1) {
                                rsyserr(FERROR_XFER, errno, "open %s failed",
                                        full_fname(fname));
-                       }
+                       } else if (updating_basis_or_equiv)
+                               cleanup_set(NULL, NULL, file, fd1, fd2);
                } else {
                        fd2 = open_tmpfile(fnametmp, fname, file);
                        if (fd2 != -1)


-- 
The rsync repository.
_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to