btrfs: verify the behavior of deleting non-existing device
authorQu Wenruo <wqu@suse.com>
Fri, 6 Aug 2021 11:33:33 +0000 (19:33 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 8 Aug 2021 14:09:03 +0000 (22:09 +0800)
commitda693469b7a1c6a48a7ec2f9f97c676272d1908f
treedf6085a453bb1bde75f483a8b9f0280b243666dc
parent4b7ea02dc05b231bbdc23793431ee44ae5b42180
btrfs: verify the behavior of deleting non-existing device

There is a kernel regression for btrfs, that when passing
non-existing devid to "btrfs device remove" command, kernel will
crash due to NULL pointer dereference.

The test case is for such regression, it will:

- Create and mount an empty single-device btrfs
- Try to remove devid 3, which doesn't exist for above fs
- Make sure the command exits properly with expected error message

The kernel fix is titled "btrfs: fix NULL pointer dereference when
deleting device by invalid id".

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/244 [new file with mode: 0755]
tests/btrfs/244.out [new file with mode: 0644]