On Wed, Nov 13, 2019 at 9:05 AM Balachandra KUMAR <balachandra.kumar.ext@xxxxxxxxx> wrote: > > Hi MTD Experts, > > I am hitting the below problem : > UBI assert failed in ubi_wl_init at line 1632 > -> ubi_assert(ubi->good_peb_count == found_pebs); > > The issue is because, in the scan_peb( ) , a specific PEB is found to > be corrupted in the volume header CRC calculation which is a > UBI_IO_BAD_HDR error. It is not just a CRC error. UBI found that the a volume header is bad *and* follow up data is good. This must not happen. Like the error message says, this needs manual inspection. > Later in scan_peb ( ), my target hits the else part saying its an > unexpected corruption. > [attach.c] > else if (!err) > /* This corruption is caused by a power cut */ > err = add_to_list(ai, pnum, UBI_UNKNOWN, > UBI_UNKNOWN, ec, 1, &ai->erase); > else { > /* This is an unexpected corruption */ > err = add_corrupted(ai, pnum, ec); > } If you hit this code path you are already in deep trouble. Data corrupted and UBI cannot say why. > The count of good peb is done as below : > /* code snippet in attach.c */ > ubi->bad_peb_count = ai->bad_peb_count; (this is 0 in my case) > ubi->good_peb_count = ubi->peb_count - ubi->bad_peb_count; > (total_peb_count(3464) - 0 = 3464) but what about the corrupted one? > ubi->corr_peb_count = ai->corr_peb_count; (this is 1) > > Why is > good_peb_count = peb_count - bad_peb_count ? (why not minus > corrupt_peb_count or add it to erase list?) > > in the ubi_wl_init ( ) , the found_pebs is calculated from erase list > and free list and we skip the corrupted peb list. But the good_count > cotains the corrupted count as well. > So , i hit this problem -> > ubi_assert(ubi->good_peb_count == found_pebs); > > What is the logic behind this good_peb_count? It counts the good PEBs, as the name denotes. But the key here is that "good" means anything which is not a bad block. Corrupted PEBs are something in between. These are blocks which should be good but aren't. What is the value of accounting them? Like I said if you face this type of error you lost already data and the upper layer (maybe UBIFS) is dead. > -- > *This e-mail message is intended for the internal use of the intended > recipient(s) only. > The information contained herein is > confidential/privileged. Its disclosure or reproduction is strictly > prohibited. > If you are not the intended recipient, please inform the sender > immediately, do not disclose it internally or to third parties and destroy > it. Please don't send to public mailing lists with this footer. Many people will ignore your mails otherwise. -- Thanks, //richard ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/