From 1a10ca78f6ad5a06b138fa7bd692f799322066ee Mon Sep 17 00:00:00 2001 From: Dave Gordon Date: Tue, 6 Mar 2018 19:52:48 +0000 Subject: [PATCH] Add fdatasync() and fsync() before close of target file Just to see whether there's an issue with delayed write failures on ZFS with quotas enabled. --- receiver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/receiver.c b/receiver.c index d6a48f1..601e765 100644 --- a/receiver.c +++ b/receiver.c @@ -847,6 +847,16 @@ int recv_files(int f_in, int f_out, char *local_name) if (fd1 != -1) close(fd1); + if (fdatasync(fd2) < 0) { + rsyserr(FERROR, errno, "fdatasync failed on %s", + full_fname(fnametmp)); + exit_cleanup(RERR_FILEIO); + } + if (fsync(fd2) < 0) { + rsyserr(FERROR, errno, "fsync failed on %s", + full_fname(fnametmp)); + exit_cleanup(RERR_FILEIO); + } if (close(fd2) < 0) { rsyserr(FERROR, errno, "close failed on %s", full_fname(fnametmp)); -- 2.7.4