[PATCH] One more -x to not traverse cyclic bind-mounts

Jeff Hansen jhansen at cardaccess-inc.com
Wed Jan 19 12:40:01 MST 2011

On 01/18/2011 05:45 PM, Wayne Davison wrote:
> On Tue, Jan 18, 2011 at 11:27 AM, Jeff Hansen 
> <jhansen at cardaccess-inc.com <mailto:jhansen at cardaccess-inc.com>> wrote:
>     I hate to beat an (apparently) dead horse, but I've tested this
>     patch on several systems and I would really appreciate it if this
>     patch (or some variation of it) went into mainline.
> You patch just prevents recursing into subdirectories of the 
> directories mentioned as command-line args...
Exactly.  Which is the purpose of the '-x' flag to begin with: rsync an 
entire filesystem without forcing the user to worry about manually 
excluding satellite filesystems.  With -x, I can do an "rsync -avx / 
host:/backup" and automatically exclude any non-rootfs mounted 
filesystems, permanent or temporary, from my backup.  -x works 
wonderfully in that regard, and makes my life easier (and I'm sure there 
are others that use it besides myself), except in the case of the bind 

All this patch does is carry the essence of the -x option one step 
further: to exclude bind mounts (and other potentially similar mounts) 
that -- to myself -- are not conceptually part of the "one" file system 
to begin with. This patch non-invasively fixes what I consider to be a 
hole in the original -x implementation.

Basically, it feels like you are telling me that I shouldn't be using -x 
at all, which I doubt would be very popular, as I'm sure there are many 
that use it.

> I can think of no nice, portable way to discover bind mounts, so I'll 
> leave it up to the user to tell rsync which dirs to elide.
The way rsync determines if the directory is a mount point looks very 
portable to me (with the FLAG_TOP_DIR bit), and with this patch, it has 
worked on every Linux system I've tried so far (not sure if FLAG_TOP_DIR 
works on BSDs, but I'm guessing it does).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20110119/25e81b87/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5622 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.samba.org/pipermail/rsync/attachments/20110119/25e81b87/attachment.bin>

More information about the rsync mailing list