[PATCH 1/3] MTD: blktrans: Final version of hotplug support

Maxim Levitsky maximlevitsky at gmail.com
Sat Sep 18 19:12:36 EDT 2010


Or at least this patch claims it to be so...

Now it once again possible to remove mtdtrans and mtd drivers even
if underlying mtd device is mounted.
This time in addition to code review, I also made the code
pass some torture tests like module reload in  a loop + read in a loop +
card insert/removal all at same time.

The blktrans_open/blktrans_release don't take the mtd table lock because:

While device is added (that includes execution of add_mtd_blktrans_dev)
the lock is already taken

Now suppose the device will never be removed. In this case even if we have changes
in mtd table, the entry that we need will stay exactly the same. (Note that we don't
look at table at all, just following private pointer of block device).

Now suppose that someone tries to remove the mtd device.
This will be propagated to trans driver which _ought_ to call del_mtd_blktrans_dev
which will take the per device lock, release the mtd device and set trans->mtd = NULL.


More information about the linux-mtd mailing list