• Josef Bacik's avatar
    btrfs: don't show full path of bind mounts in subvol= · f50a0aba
    Josef Bacik authored
    [ Upstream commit 3ef3959b ]
    
    Chris Murphy reported a problem where rpm ostree will bind mount a bunch
    of things for whatever voodoo it's doing.  But when it does this
    /proc/mounts shows something like
    
      /dev/sda /mnt/test btrfs rw,relatime,subvolid=256,subvol=/foo 0 0
      /dev/sda /mnt/test/baz btrfs rw,relatime,subvolid=256,subvol=/foo/bar 0 0
    
    Despite subvolid=256 being subvol=/foo.  This is because we're just
    spitting out the dentry of the mount point, which in the case of bind
    mounts is the source path for the mountpoint.  Instead we should spit
    out the path to the actual subvol.  Fix this by looking up the name for
    the subvolid we have mounted.  With this fix the same test looks like
    this
    
      /dev/sda /mnt/test btrfs rw,relatime,subvolid=256,subvol=/foo 0 0
      /dev/sda /mnt/test/baz btrfs rw,relatime,subvolid=256,subvol=/foo 0 0
    Reported-by: default avatarChris Murphy <chris@colorremedies.com>
    CC: stable@vger.kernel.org # 4.4+
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    f50a0aba
super.c 66.2 KB