RFC: Mount namespace option

Marian Marinov mm at yuhu.biz
Thu Apr 3 05:25:51 MDT 2014

Hello guys,
I'm working a lot with Linux Containers(LXC) and find it extremely nice to have the ability to rsync files from the host 
machine to the container without the need of SSH.

What I did was a simple patch, which added the new option --mount-ns-pid=PID and also added a call to setns() in the 
do_fork() function.

The idea is, that rsync will use the PID to create a path (/proc/PID/ns/mnt), open that path and give the file 
descriptor to setns(), which in turn will switch to the new mount namespace and so, the file operations will be done in 
the new mount namespace instead of the host's own mount namespace.

Are you interested in such functionality for rsync?

If you are interested, can we discuss the questions bellow? :)

- Can someone tell me what is the accepted way of accepting patches?
I currently have the patches done for the 3.0.9 branch and for 3.1.0 branch.

- setns() is found only on newer libc versions.
I have copied the implementation from the LXC project, but with a small change, if setns is not supported on the machine 
at all it returns error. I have placed the implementation in rsync.h, but what would be the proper place for it?

- should I add configure option for this new functionality?

Thank you, for your comments.

Best regards,

More information about the rsync mailing list