DO NOT REPLY [Bug 4899] New: When a mounted dir cannot be visited, rsync will halt there and the shell is halted, even "ctrl -c" can't quit it.

samba-bugs at samba.org samba-bugs at samba.org
Mon Aug 20 07:31:29 GMT 2007


https://bugzilla.samba.org/show_bug.cgi?id=4899

           Summary: When a mounted dir cannot be visited, rsync will halt
                    there and the shell is halted, even "ctrl -c" can't quit
                    it.
           Product: rsync
           Version: 2.6.9
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: dpei at cisco.com
         QAContact: rsync-qa at samba.org


Problem: When a mounted dir(for example, "mnt") cannot be visited, rsync will
halt there and the shell is halted, even "ctrl -c" can't quit it. If the mountd
dir is filtered out, rsync still fail to work.

dirA_________dir1
          |__ mnt

dirB_________dir1
$rsync -r -vvvvvvv -L --include-from=filter --exclude="*" dirA/ dirB/

Root cause:
related brief process of rsync:
1 client_run(), called once the connection has been negotiated.
2 read the filter.
3 send_file_list(). 
4 send_files().

In step 3, rsync will examine the file one by one, to decide whether it is a
symblic, whether it is filtered, and so on. It revokes  do_stat to check the
file status.
int do_stat(const char *fname, STRUCT_STAT *st)
{
#if HAVE_OFF64_T
 return stat64(fname, st);
#else
 return stat(fname, st);
#endif
}

It revokes system function "stat", which will halt when the mounted dir is
crashed. 
The "stat" issue is not due to rsync. But if the mountd dir is filtered out,
rsync should work well.

Solution:
Modified "flist.c", 
struct file_struct *make_file(char *fname, struct file_list *flist,
                              STRUCT_STAT *stp, unsigned short flags,
                              int filter_level)
{
...
        memset(sum, 0, SUM_LENGTH);

        /* In case a mounted dir crashed, than stat will hang there even
           the dir has been filtered */
        if (filter_level != NO_FILTERS
            && is_excluded(thisname, 1, filter_level)) {
                rprintf(FINFO, "Excluding %s\n", thisname);
                return NULL;
        } else if (stp && S_ISDIR(stp->st_mode)) {
                st = *stp; /* Needed for "symlink/." with --relative. */
                *linkname = '\0'; /* make IBM code checker happy */
        } else if (readlink_stat(thisname, &st, linkname) != 0) {
...
}


}


-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list