Question about scrubbing and ECC errors (in UBI)

David Gideon gideonda32 at gmail.com
Thu Jul 20 18:55:40 PDT 2023


Hi,

I have a general question about how ECC errors are handled in
drivers/mtd/ubi/eba.c.  I am using a Micron raw NAND part with on-die
ECC and an ECC strength of 4 bits.

I simulated an ECC error via some error injection code, to see whether
or not the UBI layer would mark it for scrubbing.  But I saw that UBI
didn't want to mark it for scrubbing, due to it being a UBI dynamic
volume.  Here's the relevant code (which seems to have been around
since 2006, and still exists on 6.x-series kernels).

I'm just wondering; what is the motivation/reasoning behind only
setting 'scrub = 1' (and scrubbing) if it is _not_ a dynamic volume?
Why only scrub if it's a static volume?  I would have thought that
scrubbing a PEB would be beneficial in all cases that an ECC error
occurred.

err = ubi_io_read_data(ubi, buf, pnum, offset, len);
if (err) {
    if (err == UBI_IO_BITFLIPS)
        scrub = 1;
    else if (mtd_is_eccerr(err)) {
        if (vol->vol_type == UBI_DYNAMIC_VOLUME)
            goto out_unlock;
        scrub = 1;
        if (!check) {
            ubi_msg(ubi, "force data checking");
            check = 1;
            goto retry;
        }
    } else
        goto out_unlock;
}

Thanks!
- DG



More information about the linux-mtd mailing list