John Van Essen
2004-Jan-19 09:21 UTC
File that "vanish"es between readdir and stat is not IO error
Using rsync 2.6.0 with --verbose and doing a pull.>?receiving file list ... readlink "{FILENAME}" failed: >?No such file or directory >?done >?IO error encountered - skipping file deletionThe file was a temporary file that was being deleted just as the rsync was run. So while the file list was being built, it was there when the directory was read but had vanished by the time the stat() was done to get the file details. In make_file(), when readlink_stat() fails, if error is NOENT then perhaps do the same that that send_files() now does and report as vanished and set IOERR_VANISHED? -- John Van Essen Univ of MN Alumnus <vanes002@umn.edu>
Wayne Davison
2004-Mar-30 11:02 UTC
File that "vanish"es between readdir and stat is not IO error
On Mon, Jan 19, 2004 at 03:21:16AM -0600, John Van Essen wrote:> In make_file(), when readlink_stat() fails, if error is NOENT > then perhaps do the same that that send_files() now does and > report as vanished and set IOERR_VANISHED?Appended is a first-cut of a patch to implement this. I'm considering adding this into 2.6.1. Opinions welcomed. ..wayne.. -------------- next part -------------- --- flist.c 11 Feb 2004 02:48:58 -0000 1.205 +++ flist.c 30 Mar 2004 10:57:55 -0000 @@ -33,6 +33,7 @@ extern int verbose; extern int do_progress; extern int am_root; extern int am_server; +extern int am_daemon; extern int always_checksum; extern int module_id; extern int ignore_errors; @@ -747,18 +748,26 @@ struct file_struct *make_file(char *fnam if (readlink_stat(thisname, &st, linkname) != 0) { int save_errno = errno; - if (errno == ENOENT && exclude_level != NO_EXCLUDES) { + if (errno == ENOENT) { + enum logcode c = am_daemon && protocol_version < 28 + ? FERROR : FINFO; /* either symlink pointing nowhere or file that * was removed during rsync run; see if excluded * before reporting an error */ - if (check_exclude_file(thisname, 0, exclude_level)) { + if (exclude_level != NO_EXCLUDES + && check_exclude_file(thisname, 0, exclude_level)) { /* file is excluded anyway, ignore silently */ return NULL; } + io_error |= IOERR_VANISHED; + rprintf(c, "file has vanished: %s\n", + full_fname(thisname)); + } + else { + io_error |= IOERR_GENERAL; + rprintf(FERROR, "readlink %s failed: %s\n", + full_fname(thisname), strerror(save_errno)); } - io_error |= IOERR_GENERAL; - rprintf(FERROR, "readlink %s failed: %s\n", - full_fname(thisname), strerror(save_errno)); return NULL; }