UBIFS: file data corruption during the power cut-off test

Richard Weinberger richard at nod.at
Sun Jun 9 01:53:34 PDT 2019

----- Ursprüngliche Mail -----
> Now, the question: why are these 512 bytes of zeros in test4?
> Extrapolating to a real use case, consider a system writing a log file
> to the UBI partition. Power cutoff, recovery, and we have a garbage at
> the end of the log file. Is this expected?

Well, zero bytes are not garbage. ;)
But yes, this is is expected. In your case, I guess, the inode size
does not match exactly what is present on flash.
So the file size is 512 bytes too large, if you read too far, 0x0 bytes are returned.
During journal replay UBIFS tries to fixup file lengths but is approach
does not work in all cases perfectly.

This case is actually documented, please see:


More information about the linux-mtd mailing list