diff options
| author | Zhihao Cheng <chengzhihao1@huawei.com> | 2026-07-04 16:30:40 +0800 |
|---|---|---|
| committer | Richard Weinberger <richard@nod.at> | 2026-08-11 23:33:18 +0200 |
| commit | 420477a84f1e52babfe60a43dbdd0988ed956845 (patch) | |
| tree | f2bd302a819f7b3f7a2ede5ddbe9cf047e05abd4 /scripts/const_structs.checkpatch | |
| parent | 4e5e02340a18183b0f8ad633da1516cad92ee43e (diff) | |
| download | linux-420477a84f1e52babfe60a43dbdd0988ed956845.tar.gz linux-420477a84f1e52babfe60a43dbdd0988ed956845.zip | |
UBI: Preserve torture flag when rescheduling failed erasures
In __erase_worker(), when ubi_sync_erase() returns -EINTR, -ENOMEM,
-EAGAIN, or -EBUSY, the physical eraseblock is rescheduled for erasure
via schedule_erase() with the torture flag hardcoded to 0. This
unconditionally drops the torture request.
If the error occurred before torture_peb() completed (e.g., -ENOMEM
from the ec_hdr allocation in ubi_sync_erase(), errors from
self_check_not_bad()/nor_erase_prepare() in ubi_io_sync_erase(), or
torture_peb() failing mid-test because its internal do_sync_erase()/
ubi_io_read()/ubi_io_write() returned one of the above error codes),
the torture test was never finished. Such a PEB may reach the free
pool without being tortured, defeating the purpose of the torture
test for detecting marginally-bad eraseblocks.
If the error occurred after torture_peb() succeeded (the final
do_sync_erase() in ubi_io_sync_erase() or ubi_io_write_ec_hdr() in
ubi_sync_erase() failed), the torture has already been done and need
not be repeated.
Pass the torture flag by pointer to ubi_sync_erase() and
ubi_io_sync_erase(), and clear it to zero once torture_peb() has
completed successfully. __erase_worker() then forwards the updated
wl_wrk->torture to schedule_erase(): torture already done is dropped,
torture not completed is preserved across the reschedule.
Fixes: 784c145444e7 ("UBI: fix error handling in erase worker")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'scripts/const_structs.checkpatch')
0 files changed, 0 insertions, 0 deletions
