[PATCH blktests v2 0/2] bcache: add bcache/001
Daniel Wagner <[email protected]> Wed, 21 Jan 2026 15:36:21 +0100
| Newsgroups | org.kernel.vger.linux-bcache,org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
I've got it working. The problem is that udevd sometimes doesn't register the
devices in a timely fashion. The workaround is to explicitly register the
devices within the tests. This races with udevd, thus some logic is in there to
filter out 'already registered warnings'. Eventually someone should look at
this...
Also made the wiping of the disks a bit more robust by stealing the ideas from
Stephen's test case[1]. Thanks!
As requested I also added an entry in running-tests.md. There is already a
section on TEST_CASE_DEV_ARRAY so it's a bit redudant but given it took me a
while to figure this out, I think it's worth to have it around.
Now, the test runs very stable in my VM. No issues in hundres of of runs:
bcache/001 => nvme0n1 vdb vdc (test bcache setup and teardown) [passed]
runtime 4.659s ... 3.555s
The runtime is not really constant, one of the symptions with all the
workarounds in place to get it working (retry loops, white loops etc).
[ 5327.588585][T100690] run blktests bcache/001 at 2026-01-21 14:33:45
[ 5327.742119][T100766] bcache: run_cache_set() invalidating existing data
[ 5327.747790][T100766] bcache: register_cache() registered cache device nvme0n1
[ 5327.782118][T100690] bcache: register_bcache() error : device already registered
[ 5327.790339][T100690] bcache: register_bdev() registered backing device vdb
[ 5327.798633][T100690] bcache: bch_cached_dev_attach() Caching vdb as bcache0 on set 33fc88e8-3251-433e-be43-620f625c
[ 5329.598292][T100396] bcache: bcache_device_free() bcache0 stopped
[ 5329.898146][T94893] bcache: cache_set_free() Cache set 33fc88e8-3251-433e-be43-620f6253e0fc unregistered
[ 5330.315859][T100803] bcache: run_cache_set() invalidating existing data
[ 5330.324537][T100803] bcache: register_cache() registered cache device nvme0n1
[ 5330.330337][T100809] bcache: register_bdev() registered backing device vdc
[ 5330.339168][T100809] bcache: bch_cached_dev_attach() Caching vdc as bcache0 on set 986fa332-8e02-4a1e-942c-b6f3458e
[ 5330.345113][T100813] bcache: register_bdev() registered backing device vdb
[ 5330.362462][T100813] bcache: bch_cached_dev_attach() Caching vdb as bcache1 on set 986fa332-8e02-4a1e-942c-b6f3458e
[ 5330.466850][T100690] bcache: register_bcache() error : device already registered
[ 5330.469039][T100690] bcache: register_bcache() error : device already registered
[ 5330.470933][T100690] bcache: register_bcache() error : device already registered
[ 5330.472971][T100690] bcache: register_bcache() error : device already registered
[ 5330.474847][T100690] bcache: register_bcache() error : device already registered
[ 5330.522678][T11701] bcache: bcache_device_free() bcache1 stopped
[ 5330.571838][T11701] bcache: bcache_device_free() bcache0 stopped
[ 5330.805725][T80064] bcache: cache_set_free() Cache set 986fa332-8e02-4a1e-942c-b6f3458470fe unregistered
The next step is to figure out how to hand back the devices to calling test, so
the test doesn't have to hardcode the test device. From Stephen's test:
[...]
# 2. Detach
log "Detaching backing device..."
BDEV_NAME=$(basename $BCACHE_DEV)
echo 1 | sudo tee /sys/block/$BDEV_NAME/bcache/detach > /dev/null
[...]
I am sure there is some bash-way to do this, which makes me blind. But hey, if
it works, I wont complain.
[1] https://lore.kernel.org/linux-bcache/CANubcdX7eNbH_bo4-f94DUbdiEbt04Vxy1MPyhm+CZyXB01FuQ@mail.gmail.com/
Signed-off-by: Daniel Wagner <[email protected]>
---
Changes in v2:
- fixed whitespace damage
- added documentation on how to configure for bcache tests
- do registering explicitly
- made disk wiping more robust
- Link to v1: https://patch.msgid.link/[email protected]
---
Daniel Wagner (2):
bcache: add bcache/001
doc: document how to configure bcache tests
Documentation/running-tests.md | 16 +++
tests/bcache/001 | 32 +++++
tests/bcache/001.out | 1 +
tests/bcache/rc | 259 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 308 insertions(+)
---
base-commit: e387a7e0169cc012eb6a7140a0561d2901c92a76
change-id: 20260120-bcache-35ec7368c8f4
Best regards,
--
Daniel Wagner <[email protected]>