diff options
author | FlyingWombat <25214020+FlyingWombat@users.noreply.github.com> | 2022-07-11 15:42:34 -0600 |
---|---|---|
committer | FlyingWombat <25214020+FlyingWombat@users.noreply.github.com> | 2022-07-18 14:18:24 -0600 |
commit | d9afeb013fb809500fd222bdca97f0772ff6a282 (patch) | |
tree | 11dc5e4f3fc8410a2e02aa08e628f7fcb82b1f33 | |
parent | a8a149777035bef9d4830c231ed942824e1d3b3d (diff) |
tests/bcachefs: add three tests to replication.ktest
test_device_repeated_add_remove(){
Test rapidly adding and removing the same device.
Caught bugs:
- found a race condition that leads to a kernel BUG in btree_key_cache.
test_add_label(){
Test setting device label when adding
Caught bugs:
- label was not set correctly; set to dev-0 label instead of new one.
test_add_compound_label(){
Test adding a device with a compond label, a '.' separated "path"
(e.g. ssd.sata)
Caught bugs:
- filesystem crashed with message "Invalid superblock section disk_groups".
-rwxr-xr-x | tests/bcachefs/replication.ktest | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/bcachefs/replication.ktest b/tests/bcachefs/replication.ktest index 0bd6503..2123af1 100755 --- a/tests/bcachefs/replication.ktest +++ b/tests/bcachefs/replication.ktest @@ -260,6 +260,35 @@ test_device_add() umount /mnt } +test_device_add_label() +{ + # Test setting device label when adding + # Caught bugs: + # - label was not set correctly; set to dev-0 label instead of new one. + + bcachefs format -L test_add_label --label=foo /dev/sdb + mount -t bcachefs /dev/sdb /mnt + bcachefs device add --label=bar /mnt /dev/sdc + expect_sysfs dev-1 label bar + umount /mnt +} + +test_device_add_label_compound() +{ + # Test adding a device with a compond label, a '.' separated "path" + # (e.g. ssd.sata) + # Caught bugs: + # - filesystem crashed with message "Invalid superblock section disk_groups". + + set_watchdog 30 + + bcachefs format -L test_add_compound_label --label=hdd /dev/sdb + mount -t bcachefs /dev/sdb /mnt + bcachefs device add --label=foo.bar /mnt /dev/sdc + expect_sysfs dev-1 label foo.bar + umount /mnt +} + test_device_set_state() { set_watchdog 120 @@ -386,6 +415,30 @@ test_device_readd() umount /mnt } +test_device_repeated_add_remove() +{ + ## Test rapidly adding and removing the same device. + # Caught bugs: + # - found a race condition that leads to a kernel BUG in btree_key_cache. + + set_watchdog 120 + + bcachefs format -L test_device_repeated_add_remove --label=hdd /dev/sdb + mount -t bcachefs /dev/sdb /mnt + + for ii in {1..10}; do + echo "add-remove run #$ii ----------------------------------------------------" + echo "bcachefs device add" + bcachefs device add /mnt /dev/sdc + echo "bcachefs device evacuate" + bcachefs device evacuate /dev/sdc + echo "bcachefs device remove" + bcachefs device remove /dev/sdc + done + + umount /mnt +} + do_replicas_errors_test() { set_watchdog 180 |