int cvs_exclude = 0;
int dry_run = 0;
int do_xfers = 1;
+int do_fsync = 0;
int ignore_times = 0;
int delete_mode = 0;
int delete_during = 0;
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
{"contimeout", 0, POPT_ARG_INT, &connect_timeout, 0, 0, 0 },
{"no-contimeout", 0, POPT_ARG_VAL, &connect_timeout, 0, 0, 0 },
+ {"fsync", 0, POPT_ARG_NONE, &do_fsync, 0, 0, 0 },
{"stop-after", 0, POPT_ARG_STRING, 0, OPT_STOP_AFTER, 0, 0 },
{"time-limit", 0, POPT_ARG_STRING, 0, OPT_STOP_AFTER, 0, 0 }, /* earlier stop-after name */
{"stop-at", 0, POPT_ARG_STRING, 0, OPT_STOP_AT, 0, 0 },
args[ac++] = tmpdir;
}
+ if (do_fsync)
+ args[ac++] = "--fsync";
+
if (basis_dir[0]) {
/* the server only needs this option if it is not the sender,
* and it may be an older version that doesn't know this
extern int preserve_perms;
extern int write_devices;
extern int preserve_xattrs;
+extern int do_fsync;
extern int basis_dir_cnt;
extern int make_backups;
extern int cleanup_got_literal;
sum_len = sum_end(file_sum1);
+ if (do_fsync && fd != -1 && fsync(fd) != 0) {
+ rsyserr(FERROR, errno, "fsync failed on %s", full_fname(fname));
+ exit_cleanup(RERR_FILEIO);
+ }
+
if (mapbuf)
unmap_file(mapbuf);
--bwlimit=RATE limit socket I/O bandwidth
--stop-after=MINS Stop rsync after MINS minutes have elapsed
--stop-at=y-m-dTh:m Stop rsync at the specified point in time
+--fsync fsync every written file
--write-batch=FILE write a batched update to FILE
--only-write-batch=FILE like --write-batch but w/o updating dest
--read-batch=FILE read a batched update from FILE
mind that the remote host may have a different default timezone than your
local host.
+0. `--fsync`
+
+ Cause the receiving side to fsync each finished file. This may slow down
+ the transfer, but can help to provide peace of mind when updating critical
+ files.
+
0. `--write-batch=FILE`
Record a file that can later be applied to another identical destination
#include "rsync.h"
+int do_fsync = 0;
int inplace = 0;
int modify_window = 0;
int preallocate_files = 0;
extern int dry_run;
extern int module_id;
+extern int do_fsync;
extern int protect_args;
extern int modify_window;
extern int relative_paths;
#endif
}
+ if (do_fsync && fsync(ofd) < 0) {
+ int save_errno = errno;
+ rsyserr(FERROR, errno, "fsync failed on %s", full_fname(dest));
+ close(ofd);
+ errno = save_errno;
+ return -1;
+ }
+
if (close(ofd) < 0) {
int save_errno = errno;
- rsyserr(FERROR_XFER, errno, "close failed on %s",
- full_fname(dest));
+ rsyserr(FERROR_XFER, errno, "close failed on %s", full_fname(dest));
errno = save_errno;
return -1;
}