• Filipe Manana's avatar
    Btrfs: set dead flag on the right root when destroying snapshot · c55bfa67
    Filipe Manana authored
    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: default avatarFilipe David Borba Manana <fdmanana@gmail.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.cz>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    c55bfa67
ioctl.c 122 KB