Stale cached data in bdbuf creates problems

ali nasir supremenasir at yahoo.com
Wed May 2 06:48:22 UTC 2012


Hello,

I have the following set up.
/dev/sdc01 is mounted succesfully on /mnt/sdcard. This is the first and only partition on the device. For the time being, i use a disk with only one partition. While mounting the same, /dev/sdc0 is passed as arguments to the create_phys and to the bdpart_register_from_disk. The fstab_entry table has the first entry as /dev/sdc01 and the second one as /dev/sdc0. The first entry is always mounted succesfully. 

Now, during the unmount, i now do the following:

    rv = unmount("/mnt/sdcard");
    rv = rmdir ("/mnt/sdcard");
    dev_t dev = 0;

    rv = rtems_media_get_device_identifier("/dev/sdc01", &dev); //SYNC the first partition
    rv = rtems_bdbuf_syncdev(dev);
    rtems_bdbuf_purge_dev(dev);
    rv = rtems_disk_delete(dev);

    rv = rtems_media_get_device_identifier("/dev/sdc0", &dev);   //SYNC the physical device
    rv = rtems_bdbuf_syncdev(dev);
    rtems_bdbuf_purge_dev(dev);
    rv = rtems_disk_delete(dev); 
    rv = rtems_io_unregister_driver(sd_card_disk_major);

All the above calls return RTEMS_SUCCESFULL. I verified it with printfs (not shown in the above code).
But still, when i insert a different size card, after the unmount of the first one, the MBR is not read from the physical device. The bdbuf determines that the data is cached and starts using this cached data, which is actually the data of the previous card. 

Do i have to do something with the rtems_chain_xx during the umount?

Regards,
Ali

------------------------------
On Tue 1 May, 2012 2:15 PM IST Sebastian Huber wrote:

>Hi,
>
>I will use this notation dev = (major, minor).  First you create a driver and get a major number.  The physical disk will be (major, 0).  Now you call rtems_bdpart_register() and this will create logical disks (major, X) with X = 1, ..., partition count.  You have to sync and purge all disks (major, 0), ..., (major, partition count).  The media manager takes care of this, maybe it make sense to port it to 4.10.
>
>-- 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