btrfs-progs: receive: handle root subvol path in clone
commita5de4d7f45976dc41e2dd619b69a048027386138
authorBenedikt Morbach <benedikt.morbach@googlemail.com>
Wed, 22 Feb 2017 22:56:37 +0000 (22 23:56 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 16 Mar 2017 16:02:44 +0000 (16 17:02 +0100)
treee621a3c235368caa055b8adaf214f2accf9440d3
parent30c7b11f7f030756d97711cef86c9891efc1d3ee
btrfs-progs: receive: handle root subvol path in clone

testcase:
    # ro subvol /src/parent
    # rw subvol /src/foo
    clone /src/parent/file /src/foo/file
    subvol snapshot -r /src/foo /src/foo.snap

    # generates a "clone parent/file -> foo.snap/file" send command
    send -p /src/parent /src/foo.snap

    # target fs:
    #    dest/
    #        |--- parent/...
    # mounted with -o subvol=dest, such that "parent" is at <target>/parent
    receive <target>

result:
    ERROR: cannot open dest/parent/file: No such file or directory

expected:
    "dest/" get's stripped from the clone source path to get the actual
    path in the target fs, if reachable from the mount point/chroot.

    This is exactly what process_snapshot does, which gets called on
    _every_ incremental receive and I'm quite certain is correct in
    doing so

Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-receive.c