• Andrew Vagin's avatar
    mount: dump a file system only if a mount point isn't overmounted · 16ae562e
    Andrew Vagin authored
    Here we try to enumerate all mount points and try to find one,
    which allows us to dump content of a file system.
    
    It's should be a root mount and its mount point should not be
    overmounted.
    
    We don't have a separate call-back to dump content of a file system.
    fstype->dump() isn't always requires access to a mount point (e.g.
    autofs), so we check overmounts in open_mountpoint().
    
    $ cat /proc/61693/root/etc/redhat-release
    Fedora release 23 (Twenty Three)
    
    $ cat /proc/61692/mountinfo  | grep '\s/tmp'
    234 199 0:57 / /tmp rw shared:97 master:76 - tmpfs tmpfs rw,size=131072k,nr_inodes=32768
    235 234 0:57 /systemd-private-dd74de99e1104383aa7cd6e27d3d0b8a-httpd.service-uFqNHk/tmp /tmp rw,relatime shared:98 master:76 - tmpfs tmpfs rw,size=131072k,nr_inodes=32768
    
    v2: return an error if we can't dump a file system
    v3: try to find a mount point which allows to dump a file system
    v4: check that children are not overmounted a target mount instead
    of getting a mnt_id for a file descriptor.
    v5: add a special error code for unreachable mount points
    Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    16ae562e
mount.c 80.7 KB