[UBI] Missing scrub when there is a bit-flip
Bhavesh Parekh
bparekh at nvidia.com
Wed Nov 23 08:28:43 EST 2011
Hi All,
I have found a possible problem in the handling of the scrubbing when there is a bit-flip.
We have modified the Nand driver to verify if proper scrubbing is done when bit-flip has happened. For this we injected the bit-flip error from the driver(for a particular block). And we match with corresponding erase call from the upper layer.
We see that some-time when there is a bit-flip we don't found the corresponding erase call. On debugging, we root-cause it to function leb_write_trylock(), where if we don't get the mutex we will return the error and the caller eba_copy_leb will return the error MOVE_CANCEL_RACE to wear_leveling_worker function.
In function wear_leveling_worker, instead of adding back the leb for scrubbing again we are adding that to the protect queue to avoid wear-leveling of this LEB. So in the current implementation we are losing the leb which needs to be scrubbed unless upper layer issues a read for that LEB again and we get the bit-flip again, in that case code is removing the LEB from the protect queue and scheduling a scrubbing.
When we used leb_write_lock instead of leb_write_trylock() then we are seeing matching erase-call for the bit-flips.
So, we are currently thinking 2 possible approaches to fix this:
1. Use leb_write_lock instead of leb_write_trylock(), but leb_write_trylock was used to avoid contention. Will adding back will have side-effect ?
2. Add the leb again in the scrubbing list for scrubbing. There is already code for the same in the implementation, (in out_not_moved case where scrubbed=1 if condition), but since we have set protect=1 we won't go in this condition. We are thinking to return two different error code from the eba_copy_leb base for two different cases in the function (one where volume is removed and another is contention). And only in case of contention set scrubbing=1 and call goto out_not_moved which will add this LEB for scrubbing again.
Which approach we should use in our system ? As we want to guarantee if there is a bit-flip, ubi handles it properly in our system.
Thanks!
Bhavesh
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
More information about the linux-mtd
mailing list