diff options
author | Filipe Manana <fdmanana@gmail.com> | 2014-05-24 23:49:24 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-09 20:20:59 -0400 |
commit | 1af56070e3ef9477dbc7eba3b9ad7446979c7974 (patch) | |
tree | d6685f9c0cbff57135a11fe573fbb2e0779a5d16 /fs/btrfs/send.c | |
parent | a79b7d4b3e8118f265dcb4bdf9a572c392f02708 (diff) |
Btrfs: send, don't error in the presence of subvols/snapshots
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>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index a86c049932f9..15cdc67ce9ad 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -1628,6 +1628,10 @@ static int lookup_dir_item_inode(struct btrfs_root *root, | |||
1628 | goto out; | 1628 | goto out; |
1629 | } | 1629 | } |
1630 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); | 1630 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); |
1631 | if (key.type == BTRFS_ROOT_ITEM_KEY) { | ||
1632 | ret = -ENOENT; | ||
1633 | goto out; | ||
1634 | } | ||
1631 | *found_inode = key.objectid; | 1635 | *found_inode = key.objectid; |
1632 | *found_type = btrfs_dir_type(path->nodes[0], di); | 1636 | *found_type = btrfs_dir_type(path->nodes[0], di); |
1633 | 1637 | ||