[PATCH 0/3] ublk: validate zoned SET_PARAMS earlier
Yao Sang <[email protected]>
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
Hi, UBLK_F_ZONED uses params.basic.chunk_sectors as zone size. ublk also uses it to calculate number of zones with ilog2(). Before this series, SET_PARAMS can accept non-power-of-2 zone size. Then the device fails later when it is started. Reject it in SET_PARAMS and add one selftest for this kind of parameter checks. Patch 1 adds the missing check. Patch 2 adds a kublk helper which sends SET_PARAMS without START_DEV. Patch 3 adds test_params_01.sh. It covers basic parameter checks and zoned parameter checks, including the non-power-of-2 zone size case. Without patch 1, the non-power-of-2 zoned case is accepted by SET_PARAMS. With patch 1, it fails in SET_PARAMS. Yao Sang (3): ublk: reject non-power-of-2 zone sizes in SET_PARAMS selftests: ublk: add helper for SET_PARAMS selftests: ublk: add SET_PARAMS validation test drivers/block/ublk_drv.c | 2 +- tools/testing/selftests/ublk/Makefile | 2 + tools/testing/selftests/ublk/kublk.c | 161 +++++++++++++++++- tools/testing/selftests/ublk/kublk.h | 18 ++ .../testing/selftests/ublk/test_params_01.sh | 114 +++++++++++++ 5 files changed, 295 insertions(+), 2 deletions(-) create mode 100755 tools/testing/selftests/ublk/test_params_01.sh -- 2.25.1