Problem with mounting a device second time.

ali nasir supremenasir at yahoo.com
Wed Apr 18 11:40:40 UTC 2012


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.

Regards,
Ali

------------------------------
On Wed 18 Apr, 2012 4:39 PM IST Sebastian Huber wrote:

>On 04/18/2012 12:47 PM, ali nasir wrote:
>> 
>> Hi,
>> 
>> We are facing some problems with mounting an sdcard the second time after removing the first one, on the RTEMS 4.10.1, for eg if a device /dev/sdc01 is mounted on /mnt/sdcard and we unmount this device, then we cannot mount the same device again. However, if we try to mount /dev/sdc02 on mnt/sdcard, then this works.
>> 
>> If we try to mount the same device again, the create_phys returns error 12 (RTEMS_RESOURCE_IN_USE).
>
>This probably means that the first disk with this name is not deleted.  It is somehow still in use.  The rtems_disk_delete() only marks the disk as deleted.  It is actually deleted once the reference count reaches zero.  Do you have logical disks as well?
>
>> Note that this error comes when we have done some write operation on the previously inserted card. If we do not do any write operation on the previous device, then we are able to mount the second card with the same device name (/dev/sdc01)
>> 
>> The unmount of the card is performed using the following calls in the sequence, with the card inserted:
>> unmount
>> rmdir
>> rtems_bdbuf_syncdev
>> rtems_disk_delete
>
>You should step with the debugger through rtems_disk_delete and verify that it calls actually free_disk_device() with the physical disk.
>
>> rtems_bdbuf_purge_dev
>> rtems_io_unregister_driver
>> The above sequence is taken from the disk_detach_worker from the media.c file
>> 
>> Can we use the media manager with the RTEMS 4.10.1 or 4.10.2? Is there an example how to use the media manger? Can the media manager solve the above mentioned problem?
>
>It is possible to back port the media manager to RTEMS 4.10, but the file system and block device support for unmount() is pretty poor and dangerous in RTEMS 4.10 and below.  Most problems are fixed with this commit:
>
>http://git.rtems.org/rtems/commit/?id=3b7c123c8d910eb60ab3b38dec6224e2de9847c9
>
>-- 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 embedded-brains.de
>PGP     : Public key available on request.
>
>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>_______________________________________________
>rtems-users mailing list
>rtems-users at rtems.org
>http://www.rtems.org/mailman/listinfo/rtems-users





More information about the users mailing list