Help needed with corruption detection/ubifs_wbuf_sync_nolock

Reginald Perrin reggyperrin at yahoo.com
Mon Jun 25 09:58:10 EDT 2012


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



More information about the linux-mtd mailing list