mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-03-19 23:06:26 -04:00
Flush write buffer on an aborted in-place transfer.
This commit is contained in:
17
NEWS
17
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
|
||||
|
||||
32
cleanup.c
32
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user