linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* ubi corrupted list not counted as bad block
@ 2019-11-13  8:04 Balachandra KUMAR
  2019-11-18  7:58 ` Richard Weinberger
  0 siblings, 1 reply; 2+ messages in thread
From: Balachandra KUMAR @ 2019-11-13  8:04 UTC (permalink / raw)
  To: linux-mtd

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.

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);
                 }

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?

Thanks
bala

-- 
*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.

In the course of our business relationship and for business purposes 
only, Valeo may need to process some of your personal data. 
For more 
information, please refer to the Valeo Data Protection Statement and 
Privacy notice available on Valeo.com 
<https://www.valeo.com/en/ethics-and-compliance/#principes>*

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ubi corrupted list not counted as bad block
  2019-11-13  8:04 ubi corrupted list not counted as bad block Balachandra KUMAR
@ 2019-11-18  7:58 ` Richard Weinberger
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2019-11-18  7:58 UTC (permalink / raw)
  To: Balachandra KUMAR; +Cc: linux-mtd

On Wed, Nov 13, 2019 at 9:05 AM Balachandra KUMAR
<balachandra.kumar.ext@valeo.com> 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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-18  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13  8:04 ubi corrupted list not counted as bad block Balachandra KUMAR
2019-11-18  7:58 ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).