Help needed with corruption detection/ubifs_wbuf_sync_nolock

Reginald Perrin reggyperrin at yahoo.com
Mon Jun 25 10:48:56 EDT 2012


Update:  

I'm now doing this, and it seems to work.  Is this correct?

if ( wbuf->dtype != UBI_UNKNOWN && ((struct ubifs_ch *)wbuf->buf)->node_type > UBIFS_ORPH_NODE ) 

...

RP


----- Original Message -----
> From: Reginald Perrin <reggyperrin at yahoo.com>
> To: MTD Mailing List <linux-mtd at lists.infradead.org>
> Cc: 
> Sent: Monday, June 25, 2012 9:58 AM
> Subject: Help needed with corruption detection/ubifs_wbuf_sync_nolock
> 
> Hi folks,
> 
> I'm tracking down a corruption issue, and trying to trace back where 
> LEB's are getting randomly corrupted in our system (a very rare event, but 
> it can happen).  I'm focusing on ubifs/io.c, and trying to validate data 
> before we send to ubi_leb_write().
> 
> Can somebody please clarify something for me on ubifs_wbuf_sync_nolock()? 
>  I'm trying to validate that the data we're writing hasn't been 
> corrupted.  I thought I could just check that the node-type was valid, such as:
> 
>     if ( ((struct ubifs_ch *)wbuf->buf)->node_type > UBIFS_ORPH_NODE ) 
> {
> 
>         // ABORT WRITE
>     }
> 
>     err = ubi_leb_write(c->ubi, wbuf->lnum, wbuf->buf, wbuf->offs,
> 
> 
> This *seems* to work, but during our application start, it's actually 
> triggering before we are reaching the troubled code, in code that really 
> shouldn't have any issues.  I think this means I don't understand how 
> wbuf relates to actual LEB nodes.
> 
> Can anybody help me understand how to check to see if the LEB is corrupted 
> before we write?  I'm trying to get close enough to the corruption to get a 
> backtrace.
> 
> TIA
> RP
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 



More information about the linux-mtd mailing list