lkml.org 
[lkml]   [2014]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.14 098/110] Btrfs: send, dont error in the presence of subvols/snapshots
    Date
    3.14-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Filipe Manana <fdmanana@gmail.com>

    commit 1af56070e3ef9477dbc7eba3b9ad7446979c7974 upstream.

    If we are doing an incremental send and the base snapshot has a
    directory with name X that doesn't exist anymore in the second
    snapshot and a new subvolume/snapshot exists in the second snapshot
    that has the same name as the directory (name X), the incremental
    send would fail with -ENOENT error. This is because it attempts
    to lookup for an inode with a number matching the objectid of a
    root, which doesn't exist.

    Steps to reproduce:

    mkfs.btrfs -f /dev/sdd
    mount /dev/sdd /mnt

    mkdir /mnt/testdir
    btrfs subvolume snapshot -r /mnt /mnt/mysnap1

    rmdir /mnt/testdir
    btrfs subvolume create /mnt/testdir
    btrfs subvolume snapshot -r /mnt /mnt/mysnap2

    btrfs send -p /mnt/mysnap1 /mnt/mysnap2 -f /tmp/send.data

    A test case for xfstests follows.

    Reported-by: Robert White <rwhite@pobox.com>
    Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Signed-off-by: Chris Mason <clm@fb.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/btrfs/send.c | 4 ++++
    1 file changed, 4 insertions(+)

    --- a/fs/btrfs/send.c
    +++ b/fs/btrfs/send.c
    @@ -1589,6 +1589,10 @@ static int lookup_dir_item_inode(struct
    goto out;
    }
    btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
    + if (key.type == BTRFS_ROOT_ITEM_KEY) {
    + ret = -ENOENT;
    + goto out;
    + }
    *found_inode = key.objectid;
    *found_type = btrfs_dir_type(path->nodes[0], di);




    \
     
     \ /
      Last update: 2014-06-28 21:21    [W:2.807 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site