]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: set dead flag on the right root when destroying snapshot
authorFilipe Manana <fdmanana@gmail.com>
Sun, 25 May 2014 02:55:44 +0000 (03:55 +0100)
committerChris Mason <clm@fb.com>
Tue, 10 Jun 2014 00:21:03 +0000 (17:21 -0700)
commitd910e940ad567d7a17e7049743f11757b9167b07
tree5c56b113d932a22ef584926f7ef9429baa9f3396
parentfd5577eaa334928f534d2cfc36aafbbc3b72f4d1
Btrfs: set dead flag on the right root when destroying snapshot

We were setting the BTRFS_ROOT_SUBVOL_DEAD flag on the root of the
parent of our target snapshot, instead of setting it in the target
snapshot's root.

This is easy to observe by running the following scenario:

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

    btrfs subvolume create /mnt/first_subvol
    btrfs subvolume snapshot -r /mnt /mnt/mysnap1

    btrfs subvolume delete /mnt/first_subvol
    btrfs subvolume snapshot -r /mnt /mnt/mysnap2

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

The send command failed because the send ioctl returned -EPERM.
A test case for xfstests follows.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c