attaching UBI while getting read errors from NAND driver fails.

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Wed Apr 21 05:13:48 EDT 2010


* Artem Bityutskiy | 2010-04-21 05:50:57 [+0300]:

>On Tue, 2010-04-20 at 20:44 +0200, Sebastian Andrzej Siewior wrote:
>> | UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 3399:0, read 64 bytes
>> So we return with -EBADMSG as you can see in the error message. This
>> error is then converted by ubi_io_read() into -EIO:
>> |                /*
>> |                 * The driver should never return -EBADMSG if it failed to read
>> |                 * all the requested data. But some buggy drivers might do
>> |                 * this, so we change it to -EIO.
>> |                 */
>> |                if (read != len && err == -EBADMSG) {
>> |                        ubi_assert(0);
>> |                        err = -EIO;
>> |                }
>> 
>Well, I think the idea was that the MTD layer tries to read all the
>requested data despite of a possible unrecoverable ECC error in the
>middle. So if it returns -EBADMSG, we know that the read buffer contains
>all the data anyway, even though some of the data may be incorrect.
>
>So, I'd suggest changing MTD and making it return read == len in that
>case.

Wait. According to the error message, I had read == len (both 64). So I
think it never got changed to -EIO, my mistake.

>> @@ -756,7 +756,8 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
>>  		bitflips = 1;
>>  	}
>>  
>> -	si->is_empty = 0;
>> +	if (err != UBI_IO_BAD_EC_HDR)
>> +		si->is_empty = 0;
>>  
>>  	if (!ec_corr) {
>>  		int image_seq;
>> @@ -827,6 +828,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
>>  			return err;
>>  		goto adjust_mean_ec;
>>  	}
>> +	si->is_empty = 0;
>>  
>>  	vol_id = be32_to_cpu(vidh->vol_id);
>>  	if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOLUME_ID) {
>
>This part looks right.

Do you want me to resend this part as the fix?

Sebastian



More information about the linux-mtd mailing list