Duplicate blocks in flash disk

Chris Johns chrisj at rtems.org
Thu Nov 17 06:22:54 UTC 2011


Hi,

Sorry about the delay. My internet connection has been up and down for 
the past couple of days and I have been snowed under (not literally; it 
is summer here).

On 17/11/11 4:08 PM, ali nasir wrote:
> Hi,
>
> We are using the RFS on the flashdisk. Sometimes we observe that when the rtems_flashdisk_initialize (which is called from the rtems_io_register_driver) is called, there are some prints on the console which says:
>
> fdisk:error:duplicate block: 0-0-104: duplicate: 0-0-108
> fdisk:error:duplicate block: 0-0-104: duplicate: 0-0-112
>

The code states:

      /**
       * @todo
       * This may need more work later. Maybe a counter is stored with
       * each block so we can tell which is the later block when
       * duplicates appear. A power down with a failed wirte could cause
       * a duplicate.
       */

> Since the return value of rtems_io_register_driver() is still 0

Correct it because the code currently does not see an error. It sees the 
duplicate and selects one of them. The comment above indicates it maybe 
a counter is needed to help track the latest one.

> the mounting continues further in our code and the code crashes in the function rtems_rfs_buffer_handle_request(). This crash happens only when the above error of duplicate blocks is seen.

Do you have any details about the crash ?

> When we see the RTEMS code, we found that even if the duplicate blocks are found, the return value of rtems_fdisk_recover_block_mappings() is still 0. This makes the code feel that everything is fine and the mounting can continue.

The actual issue could be related to some other effect the is not 
handling correctly after the duplicate is found.

> Is is OK, that we return some error if the duplicate blocks are found in the rtems_fdisk_recover_block_mappings() function? This can help in making some recovery like erasing the Flash device completely or some other thing.

How big is the flash disk ?

I would love a binary image of the data in the flash with the duplicate. 
I could then load it here and take a look.

> Please guide.

The error code is ok if we have an error. It is masking a bug we should 
find the bug.

Chris



More information about the users mailing list