removable media support on 2.6.x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

We are developing a storage driver (block driver) on 2.6.x kernel. The 
hardware we are using supports media removal on the fly. We are facing
some problem when the media is removed while the disk is mounted. The
system freezes and the module count never goes to zero.

This is what we do when the disk is removed on the fly.

disk_removed(...)
{
	/* invalidate disk */
	if(gDisk->bdev) {
		invalidate_bdev(gDisk->bdev, 1);
		bdput(gDisk->bdev);
	}

	/* indicates that no disk present */
	set_capacity(gDisk->gd, 0);

	/* cleanup gendisk */
	del_gendisk(gDisk->gd);
	put_disk(gDisk->gd);

	/* clean up blkqueue */
	blk_cleanup_queue(gDisk->blkqueue);
}

disk_removed() is called from the workqueue that is initiated from the
tasklet()<=isr() on card removal.

We guess invalidate_bdev() is the culprit ;) but would like to know
from you all if we are doing some mistake. Is there something missing
or something wrong in the way we are trying to provide removable media
support?

Thanks in advance,

-Jinu

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux