[Yaffs] Yaffs behaviour on mtd read failure

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Sven Van Asbroeck
Date:  
To: yaffs
Subject: [Yaffs] Yaffs behaviour on mtd read failure
Hello Charles,

I've been investigating a few possible hardware failure modes recently.

One thing that concerns me is yaffs' behaviour when the MTD layer's read() call fails. I understand that this is not as common as many people might believe: on nand flash, the implementation of a proper eec and block replacement algorithm will guarantee that bit errors on read are always correctable over the chip's usable lifetime.

However, back in the real world, bit errors might be introduced by improper line termination, driving the flash chip subtly out of spec, etc or even by implementing an ecc algorithm that's too weak for that particular chip. It's my understanding that uncorrectable read()s should be treated the same as failing to read a hard drive sector: as a catastrophic error.

Unfortunately yaffs seems to ignore yaffs_ReadChunkWithTagsFromNAND()'s return value when reading file data. For the reasons outlined above, shouldn't it as a minimum (perhaps after a few retries):
a) return -EIO (or some appropriate error code), so the caller is aware that the file is corrupted and no retry should be attempted;
b) retire the block where the read() problem happened

Currently, if a read failure occurs, no error code is returned, which may lead the caller to believe that the data in the read buffer is valid, which may not be the case...

I'd be very interested to hear your opinion on this.
Sven