Problem with mounting a device second time.

ali nasir supremenasir at
Thu Apr 19 06:10:46 UTC 2012

I can now localize the problem. 
What we do is the following:
1. With the SD card inserted, we write a set of files (4 to 5 files) on the card. After all the fwrite(..) has returned, we call the ioctl for the RTEMS_BLKIO_SYNCDEV to ensure that the data is written to the card. 
2. We then unmount the card by calling the below set of functions:

When we step in in the rtems_disk_delete function, the free_disk_device() is not called as the dd->uses equals 1.
3. After this, if we insert the second card, after removing the first, then the second card fails in the create_phys by returning 12

4. When we do not call the ioctl for the RTEMS_BLKIO_SYNCDEV, then we are succesfully able to unmount and also mount the second card.

Should we remove the call to the ioctl for the RTEMS_BLKIO_SYNCDEV? or is there some other solution to the problem?
Please guide.

On Wed 18 Apr, 2012 5:15 PM IST Sebastian Huber wrote:

>On 04/18/2012 01:40 PM, ali nasir wrote:
>> Hi,
>> yes. we call the rtems_bdpart_register_from_disk while mounting the sdcard. This, i guess, will create a logical disk.
>> Should we then also call the bdpart_unregister while unmounting the card?
>> Will try to debug as suggested and come back.
>The rtems_bdpart_register_from_disk() function was not intended to be used with 
>dynamic media.  The media manager was written for that.  You have to remember 
>all resources that are created during a media attach to clean them up later.
>Sebastian Huber, embedded brains GmbH
>Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
>Phone   : +49 89 18 90 80 79-6
>Fax     : +49 89 18 90 80 79-9
>E-Mail  : sebastian.huber at
>PGP     : Public key available on request.
>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>rtems-users mailing list
>rtems-users at

More information about the users mailing list