• Pavel Tikhomirov's avatar
    mount: fix can_mount_now to wait children of master's share properly · 64586567
    Pavel Tikhomirov authored
    We should not use ->bind link for checking master's children. As if we
    have two slaves shared between each other, the one mounted first will
    replace ->bind link for the other - that will break restore.
    
    Also while on it, if we do not want doubled mounts and want to
    prohibit propagation to slaves on restore we likely want all children of
    the whole master's share mounted before slave.
    
    JFYI: Actually these restriction is very strict and some cases will fail
    to restore, for instance (hope nobody does so):
    
    mkdir /test
    mount -t tmpfs test /test
    mount --make-private /test
    mkdir /test/{share,slave}
    mount -t tmpfs share /test/share --make-shared
    mount --bind /test/share/ /test/slave/
    mount --make-slave  /test/slave
    mount --make-shared /test/slave
    mkdir /test/share/slave
    mount --bind /test/slave/ /test/share/slave/
    
    cat /proc/self/mountinfo | grep test
    524 612 0:69 / /test rw,relatime - tmpfs test rw
    570 524 0:73 / /test/share rw,relatime shared:879 - tmpfs share rw
    571 524 0:73 / /test/slave rw,relatime shared:942 master:879 - tmpfs share rw
    602 570 0:73 / /test/share/slave rw,relatime shared:942 master:879 - tmpfs share rw
    603 571 0:73 / /test/slave/slave rw,relatime shared:943 master:942 - tmpfs share rw
    
    Here 603 is a propagation of 602 from master 570 to slave 571, and it is
    the only way to get such a mount as 571 and 602 are in one shared group
    now and all later mounts to them will propagate between them and create
    dublicated mounts. So to create real 603 without dups we need to have
    /test/slave mounted before /test/share/slave, which contradicts with
    current assumption.
    Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
    64586567
Name
Last commit
Last update
Documentation Loading commit data...
compel Loading commit data...
contrib Loading commit data...
coredump Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
include/common Loading commit data...
lib Loading commit data...
scripts Loading commit data...
soccr Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.compel Loading commit data...
Makefile.config Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...