[CRIU] [PATCH] zdtm: don't create loops of bind mounts

Andrew Vagin avagin at parallels.com
Sat Apr 6 15:59:26 EDT 2013


On Sat, Apr 06, 2013 at 10:53:42PM +0400, Pavel Emelyanov wrote:
> On 04/06/2013 01:18 AM, Andrey Vagin wrote:
> > Before this patch crtools/test is bound to crtools/test/dump/crtools.XXXXXXX
> > 
> > It's a main reason why sometimes "make clean" deletes all content

It was the main reason...

> > from crtools/test.
> 
> Sometimes?

Always when you have a test bind mount. You have a test bind mount, when
a test is executed. You execute a test sometimes. So "make clean"
deletes all content sometimes;).

This patch fixes this problem.

Actually this patch fixes more significan problem. If / is a shared
mount (it's defult in FC19),
$ mount --bind crtools/test crtools/test/dump/crtools.XXXXXXX
will recursively copy all previous bind mounts.

E.g:

cd crtools/test
make -j 4
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0

make -j 32 generates ~2^32 mounts.

> 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  test/zdtm.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/test/zdtm.sh b/test/zdtm.sh
> > index 31b2cbd..f71bbed 100755
> > --- a/test/zdtm.sh
> > +++ b/test/zdtm.sh
> > @@ -221,7 +221,7 @@ start_test()
> >  	else
> >  		if [ -z "$ZDTM_ROOT" ]; then
> >  			mkdir dump
> > -			ZDTM_ROOT=`mktemp -d dump/crtools-root.XXXXXX`
> > +			ZDTM_ROOT=`mktemp -d /tmp/crtools-root.XXXXXX`
> >  			ZDTM_ROOT=`readlink -f $ZDTM_ROOT`
> >  			mount --bind . $ZDTM_ROOT || return 1
> >  		fi
> > 
> 
> 


More information about the CRIU mailing list