Why the nand chip driver "should never return -EBADMSG if it failed to read all the request data"
Hi,
During UBIFS power cut tests I get this error message:
...
UBI error: ubi_io_read: error -77 while reading 126976 bytes from PEB 21:4096, read 2048 bytes
UBIFS error (pid 484): ubifs_start_scan: cannot read 126976 bytes from LEB 18:0, error -5
mount: mounting ubi13_0 on /usr/local/appdata failed: Input/output error
...
I found that's because the nand driver return immediately in an ECC unrecoverable error. So my question is:
1. Why the nand driver must continue to read all the left data?
2. Why it still can be mount successfully with YAFFS?
And, after I patched the nand driver, in most of the situations the UBIFS can be successfully recovered, but I still get this error:
...
UBI error: ubi_io_read: error -77 while reading 126976 bytes from PEB 2:4096, read 126976 bytes
UBIFS error (pid 481): insert_node: duplicate sqnum in replay
mount: mounting ubi13_0 on /usr/local/hmt/appdata failed: Invalid argument
...
Does this mean this should never happen to UBIFS? Then what could be the reason? Thank you very much, and my test environment:
# uname -a Linux (none) 2.6.31-3.3 #10 SMP Wed Apr 11 09:18:13 CST 2012 mips GNU/Linux
# Run this script, and cut power
# while :; do cp -a /usr/local/platform/f2 /usr/local/appdata/ && sync; done
# ls -l /usr/local/platform/f2 -rw-rw-r-- 1 506 506 1048576 Apr 11 2012 /usr/local/platform/f2
# xxd f2 0000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................ 0000010: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................ 0000020: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................ 0000030: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................
# mount rootfs on / type rootfs (rw) ... ubi12:platform on /usr/local/platform type ubifs (rw,relatime) ubi13_0 on /usr/local/appdata type ubifs (rw,sync,relatime) ubi14_0 on /usr/local/.appmid type ubifs (rw,relatime)
Signature · 2 lines
Have fun, Mark Zhang
Quoted 10 lines · Mark
And, after I patched the nand driver, in most of the situations the UBIFS can be successfully recovered, but I still get this error:
...
UBI error:ubi_io_read: error -77 while reading 126976 bytes from PEB 2:4096, read 126976 bytes
UBIFS error (pid 481):insert_node: duplicate sqnum in replay
mount: mountingubi13_0on/usr/local/hmt/appdatafailed: Invalid argument
...
Quoted 3 lines
Does this mean this should never happen to UBIFS? Then what could be the reason?
Thank you very much, and my test environment:
I see ubi_dbg_dump_stack() call in ubi_io_read() when it returns an error. If you have debugging enabled - you should have the dump in your kernel buffer.
Yeah, we should turn it into 'dump_stack()' to always have the dump. I'd gratefully accept a patch.
Signature · 2 lines
Best Regards, Artem Bityutskiy