UBIFS - strange behaviour after enabling chk_index

Krzeminski, Marcin (Nokia - PL/Wroclaw) marcin.krzeminski at nokia.com
Mon Sep 19 00:36:05 PDT 2016


Richard

> -----Original Message-----
> From: Richard Weinberger [mailto:richard at nod.at]
> Sent: Friday, September 16, 2016 5:59 PM
> To: Krzeminski, Marcin (Nokia - PL/Wroclaw)
> <marcin.krzeminski at nokia.com>; linux-mtd at lists.infradead.org
> Subject: Re: UBIFS - strange behaviour after enabling chk_index
> 
> Marcin,
> 
> On 15.09.2016 08:33, Krzeminski, Marcin (Nokia - PL/Wroclaw) wrote:
> >> Is this the SPI-NOR device you talked about on IRC?
> > Yes.
> 
> The one where you're facing issues after a power cut?
Yes, but more information is available now.
It is possible to reproduce missing master node case on 256KiB and 64KiB flash.
Also no need to power cut - eg. Watchdog reset can trigger it.
> 
> >> Maybe the check is broken, maybe it uncovers a hard to hit issue on
> >> your flash. Both could be.
> >>
> >> Do you emulate exactly the same device in qemu?
> > Yes, this part of HW is virtualized in Qemu, in fact the same SW build runs
> on Qemu and HW.
> > Since it reproduce on both it allows to think that this is SW related
> > (at least for now), but sure does not mean that this is UBI/UBIFS.
> >
> > Back to problem, it seem that this could be a debug facility issue,
> > since file system and data are not corrupted. If data on flash are
> > correct (I have done many test and all passed, so currently I assume
> > that drier is working properly), it could be that data in debug structure in
> this case are somehow outdated/bad (d->old_zroot).
> > In test script, if I copy the same file twice (instead of three times)
> > the problem does not reproduce.
> > I will try to debug this more, maybe you have any inside where to look?
> 
> I think chk_index exposes the power cut issue you told me on IRC.
> For whatever reason the index corrupts on your flash. And chk_index
> catches this very early.
In this case it is the UBIFS debug facility issue. Zroot is moving on flash,
but debug information is not updated - and at some point I am enabling debugs.
That simple change can fix this:

@@ -575,7 +594,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
        size_t sz;
 
        if (!dbg_is_chk_index(c))
-               return 0;
+               return dbg_old_index_check_init(c, zroot);
 
        INIT_LIST_HEAD(&list);

Obviously adding another read in commit is bad idea so it is feauture...

> 
> Maybe there is an issue in the SPI-NOR code or UBI itself has trouble with
> your flash (layout).
> 
It could be, it seem that it is easier to reproduce if UBIFS is placed on almost all flash area.

Thanks,
Marcin
> Thanks,
> //richard



More information about the linux-mtd mailing list