[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Fri Oct 1 18:23:26 UTC 2021


The branch, master has been updated
       via  3911c238 Tweak SIMD & ASM option defaults.
       via  3814dbb0 Make cygwin's curl grab the gist file. [buildall]
       via  82f023d7 Add --fsync option (promoted from patches).
       via  ec57c57b Help avoid a --sparse --inplace bug in older rsyncs.
       via  354fa581 Fix typo.
       via  d881814a Don't allow a broken samba host to cause gensend to fail.
       via  ad048d78 Allow $host_cpu to be amd64 in addition to x86_64.
       via  109dbc0b Rename cmdormsg -> cmd-or-msg.
      from  745ecf28 Fix a couple variable typos.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3911c2386623e1fbd7e985f641c1cee6ac21e067
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Sep 27 11:09:43 2021 -0700

    Tweak SIMD & ASM option defaults.

commit 3814dbb0f4f6242af67ed750cb6e556b973afc1c
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Sep 27 10:33:00 2021 -0700

    Make cygwin's curl grab the gist file. [buildall]

commit 82f023d7e3cca126d264ebb81b19feaf8731ad9a
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Sep 27 10:30:00 2021 -0700

    Add --fsync option (promoted from patches).

commit ec57c57baf848718bbab93fa0c597d15718acc5a
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon Sep 27 10:16:15 2021 -0700

    Help avoid a --sparse --inplace bug in older rsyncs.

commit 354fa581c16e7a32ae4cb7dc8266f224ab985f14
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sun Sep 26 19:27:46 2021 -0700

    Fix typo.

commit d881814a3561b96da73fa8ce5b88fb7a3a215332
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sun Sep 26 19:11:24 2021 -0700

    Don't allow a broken samba host to cause gensend to fail.

commit ad048d78aced57c7ac4434a67646edf56878b6fe
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sun Sep 26 19:11:20 2021 -0700

    Allow $host_cpu to be amd64 in addition to x86_64.

commit 109dbc0b7535e8f8094802182f9067bfdc88dfc9
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sun Sep 26 18:55:46 2021 -0700

    Rename cmdormsg -> cmd-or-msg.

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

Summary of changes:
 .github/workflows/build.yml |  2 +-
 Makefile.in                 |  8 ++++----
 cmdormsg => cmd-or-msg      |  0
 configure.ac                | 14 +++++++-------
 options.c                   | 11 ++++++++++-
 receiver.c                  |  6 ++++++
 rsync.1.md                  |  9 ++++++++-
 t_stub.c                    |  1 +
 util1.c                     | 12 ++++++++++--
 9 files changed, 47 insertions(+), 16 deletions(-)
 rename cmdormsg => cmd-or-msg (100%)


Changeset truncated at 500 lines:

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 530ec19d..1647fd2a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -92,7 +92,7 @@ jobs:
     - name: prep
       run: |
         cyg-get make autoconf automake gcc-core attr libattr-devel python38 python38-pip libzstd-devel liblz4-devel libssl-devel libxxhash0 libxxhash-devel
-        curl.exe -o git-version.h https://download.samba.org/pub/rsync/generated-files/git-version.h
+        curl.exe -o git-version.h https://gist.githubusercontent.com/WayneD/c11243fa374fc64d4e42f2855c8e3827/raw/rsync-git-version.h
         echo "C:/tools/cygwin/bin" >>$Env:GITHUB_PATH
     - name: commonmark
       run: bash -c 'python3 -mpip install --user commonmark'
diff --git a/Makefile.in b/Makefile.in
index 42bc383b..0b5973b1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -138,13 +138,13 @@ git-version.h: mkgitver $(wildcard $(srcdir)/.git/logs/HEAD)
 	$(srcdir)/mkgitver
 
 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
-	@$(srcdir)/cmdormsg disable-simd $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
+	@$(srcdir)/cmd-or-msg disable-simd $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
 
 simd-checksum-avx2.o: simd-checksum-avx2.S
-	@$(srcdir)/cmdormsg disable-asm $(CC) $(CFLAGS) --include=$(srcdir)/rsync.h -DAVX2_ASM -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/simd-checksum-avx2.S
+	@$(srcdir)/cmd-or-msg disable-asm $(CC) $(CFLAGS) --include=$(srcdir)/rsync.h -DAVX2_ASM -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/simd-checksum-avx2.S
 
 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.S config.h lib/md-defines.h
-	@$(srcdir)/cmdormsg disable-asm $(CC) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
+	@$(srcdir)/cmd-or-msg disable-asm $(CC) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
 
 tls$(EXEEXT): $(TLS_OBJ)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
@@ -178,7 +178,7 @@ gensend: gen
 	    ./rsync -ai git-version.h $(srcdir)/gists/rsync-git-version.h && \
 	    (cd $(srcdir)/gists && git commit --allow-empty-message -m '' rsync-git-version.h && git push) ; \
 	fi
-	rsync -aic $(GENFILES) git-version.h $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
+	rsync -aic $(GENFILES) git-version.h $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/ || true
 
 aclocal.m4: $(srcdir)/m4/*.m4
 	aclocal -I $(srcdir)/m4
diff --git a/cmdormsg b/cmd-or-msg
similarity index 100%
rename from cmdormsg
rename to cmd-or-msg
diff --git a/configure.ac b/configure.ac
index 74640716..d80194ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,14 +255,14 @@ __attribute__ ((target("ssse3"))) void more_testing(char* buf, int len)
 
 if test x"$enable_simd" = x""; then
     case "$host_os" in
-	*linux*) enable_simd=yes ;;
+	*linux*) ;;
 	*) enable_simd=no ;;
     esac
 fi
 
 if test x"$enable_simd" != x"no"; then
     # For x86-64 SIMD, g++ >=5 or clang++ >=7 is required
-    if test x"$host_cpu" = x"x86_64"; then
+    if test x"$host_cpu" = x"x86_64" -o x"$host_cpu" = x"amd64"; then
 	AC_LANG(C++)
 	if test x"$host_cpu" = x"$build_cpu"; then
 	    AC_RUN_IFELSE([AC_LANG_PROGRAM([SIMD_X86_64_TEST],[[if (test_ssse3(42) != 42 || test_sse2(42) != 42 || test_avx2(42) != 42) exit(1);]])],
@@ -273,7 +273,7 @@ if test x"$enable_simd" != x"no"; then
 	AC_LANG(C)
 	if test x"$CXX_OK" = x"yes"; then
 	    # AC_MSG_RESULT() is called below.
-	    SIMD="x86_64"
+	    SIMD="$host_cpu"
 	elif test x"$enable_simd" = x"yes"; then
 	    AC_MSG_RESULT(error)
 	    AC_MSG_ERROR(The SIMD compilation test failed.
@@ -281,7 +281,7 @@ Omit --enable-simd to continue without it.)
 	fi
     elif test x"$enable_simd" = x"yes"; then
         AC_MSG_RESULT(unavailable)
-        AC_MSG_ERROR(The SIMD optimizations are currently x86_64 only.
+        AC_MSG_ERROR(The SIMD optimizations are currently x86_64|amd64 only.
 Omit --enable-simd to continue without it.)
     fi
 fi
@@ -320,17 +320,17 @@ AC_ARG_ENABLE(asm,
 
 if test x"$enable_asm" = x""; then
     case "$host_os" in
-	*linux*) enable_asm=yes ;;
+	*linux*) ;;
 	*) enable_asm=no ;;
     esac
 fi
 
 if test x"$enable_asm" != x"no"; then
-    if test x"$host_cpu" = x"x86_64"; then
+    if test x"$host_cpu" = x"x86_64" -o x"$host_cpu" = x"amd64"; then
 	ASM="$host_cpu"
     elif test x"$enable_asm" = x"yes"; then
         AC_MSG_RESULT(unavailable)
-        AC_MSG_ERROR(The ASM optimizations are currently x86_64 only.
+        AC_MSG_ERROR(The ASM optimizations are currently x86_64|amd64 only.
 Omit --enable-asm to continue without it.)
     fi
 fi
diff --git a/options.c b/options.c
index 9ffc3cf7..98676d17 100644
--- a/options.c
+++ b/options.c
@@ -66,6 +66,7 @@ int open_noatime = 0;
 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;
@@ -789,6 +790,7 @@ static struct poptOption long_options[] = {
   {"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 },
@@ -2806,6 +2808,9 @@ void server_options(char **args, int *argc_p)
 			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
@@ -2828,8 +2833,12 @@ void server_options(char **args, int *argc_p)
 		if (append_mode > 1)
 			args[ac++] = "--append";
 		args[ac++] = "--append";
-	} else if (inplace)
+	} else if (inplace) {
 		args[ac++] = "--inplace";
+		/* Work around a bug in older rsync versions (on the remote side) for --inplace --sparse */
+		if (sparse_files && !whole_file)
+			args[ac++] = "--no-W";
+	}
 
 	if (files_from && (!am_sender || filesfrom_host)) {
 		if (filesfrom_host) {
diff --git a/receiver.c b/receiver.c
index b5020d07..091fcd6f 100644
--- a/receiver.c
+++ b/receiver.c
@@ -41,6 +41,7 @@ extern int preserve_hard_links;
 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;
@@ -394,6 +395,11 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
 
 	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);
 
diff --git a/rsync.1.md b/rsync.1.md
index 24457b2b..9bfda865 100644
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -461,6 +461,7 @@ detailed description below for a complete description.
 --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
@@ -2314,7 +2315,7 @@ your home directory (remove the '=' for that).
 
     >     rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/
 
-    If file's aren't linking, double-check their attributes.  Also check if
+    If files aren't linking, double-check their attributes.  Also check if
     some attributes are getting forced outside of rsync's control, such a mount
     option that squishes root to a single user, or mounts a removable drive
     with generic ownership (such as OS X's "Ignore ownership on this volume"
@@ -3257,6 +3258,12 @@ your home directory (remove the '=' for that).
     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
diff --git a/t_stub.c b/t_stub.c
index 1e1e4046..ea2013d3 100644
--- a/t_stub.c
+++ b/t_stub.c
@@ -21,6 +21,7 @@
 
 #include "rsync.h"
 
+int do_fsync = 0;
 int inplace = 0;
 int modify_window = 0;
 int preallocate_files = 0;
diff --git a/util1.c b/util1.c
index ef78a82d..1cff973f 100644
--- a/util1.c
+++ b/util1.c
@@ -27,6 +27,7 @@
 
 extern int dry_run;
 extern int module_id;
+extern int do_fsync;
 extern int protect_args;
 extern int modify_window;
 extern int relative_paths;
@@ -417,10 +418,17 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
 #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;
 	}


-- 
The rsync repository.



More information about the rsync-cvs mailing list