kernel_samsung_a53x/drivers/mtd
Zhihao Cheng 2d9a65c3d9 ubi: wl: Put source PEB into correct list if trying locking LEB failed
commit d610020f030bec819f42de327c2bd5437d2766b3 upstream.

During wear-leveing work, the source PEB will be moved into scrub list
when source LEB cannot be locked in ubi_eba_copy_leb(), which is wrong
for non-scrub type source PEB. The problem could bring extra and
ineffective wear-leveing jobs, which makes more or less negative effects
for the life time of flash. Specifically, the process is divided 2 steps:
1. wear_leveling_worker // generate false scrub type PEB
     ubi_eba_copy_leb // MOVE_RETRY is returned
       leb_write_trylock // trylock failed
     scrubbing = 1;
     e1 is put into ubi->scrub
2. wear_leveling_worker // schedule false scrub type PEB for wl
     scrubbing = 1
     e1 = rb_entry(rb_first(&ubi->scrub))

The problem can be reproduced easily by running fsstress on a small
UBIFS partition(<64M, simulated by nandsim) for 5~10mins
(CONFIG_MTD_UBI_FASTMAP=y,CONFIG_MTD_UBI_WL_THRESHOLD=50). Following
message is shown:
 ubi0: scrubbed PEB 66 (LEB 0:10), data moved to PEB 165

Since scrub type source PEB has set variable scrubbing as '1', and
variable scrubbing is checked before variable keep, so the problem can
be fixed by setting keep variable as 1 directly if the source LEB cannot
be locked.

Fixes: e801e128b220 ("UBI: fix missing scrub when there is a bit-flip")
CC: stable@vger.kernel.org
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-17 13:24:19 +01:00
..
chips
devices Revert "mtd: slram: insert break after errors in parsing the map" 2024-11-24 00:23:27 +01:00
hyperbus
lpddr
maps mtd: maps: physmap-core: fix flash size larger than 32-bit 2024-11-19 08:44:54 +01:00
nand mtd: rawnand: atmel: Fix possible memory leak 2024-12-17 13:24:08 +01:00
parsers mtd: partitions: redboot: Added conversion of operands to a larger type 2024-11-19 14:19:32 +01:00
spi-nor
tests mtd: make mtd_test.c a separate module 2024-11-23 23:20:10 +01:00
ubi ubi: wl: Put source PEB into correct list if trying locking LEB failed 2024-12-17 13:24:19 +01:00
ftl.c
inftlcore.c
inftlmount.c
Kconfig
Makefile
mtd_blkdevs.c
mtdblock.c
mtdblock_ro.c
mtdchar.c
mtdconcat.c
mtdcore.c
mtdcore.h
mtdoops.c
mtdpart.c
mtdpstore.c
mtdsuper.c
mtdswap.c
nftlcore.c
nftlmount.c
rfd_ftl.c
sm_ftl.c
sm_ftl.h
ssfdc.c