[PATCH] 3/3 maple: update bus driver to support Dreamcast VMU

Jörn Engel joern at logfs.org
Mon Mar 24 13:38:56 EDT 2008


On Mon, 24 March 2008 18:07:07 +0100, Jörn Engel wrote:
> 
> The second rearranges the list locking a bit.  Previously it was
> possible to touch maple_waitq or maple_sentq without holding the lock.
> With my limited understanding of the driver, the second patch may
> already be enough to prevent the type of corruption you've been seeing.

Limited understanding indeed.  The problem in the mtd driver is that it
has no concept of ownership.  For example maple_vmu_read_block() does
the following:
	mdev->mq->sendbuf = sendbuf;
	...
	maple_add_packet(mdev->mq);

It accesses some field in mdev->mq, then sends the structure off to
maple_add_packet().  From this point on, mdev->mq belongs to the bus
driver - until it calls the callback, vmu_blockread() in this case.

But a second thread can call into maple_vmu_read_block() again and
access mdev->mq while it rightfully belongs to the bus driver.  Bad
things will happen.

So these two patches try to close the race windows.  Please note the
FIXME in the write patch - I didn't do all the work.  Real life calls
for attention, so these will be the last patches for a while.

Jörn

-- 
The only good bug is a dead bug.
-- Starship Troopers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cu8.patch
Type: text/x-diff
Size: 3914 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20080324/d9295fa9/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cu9.patch
Type: text/x-diff
Size: 1902 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20080324/d9295fa9/attachment-0003.bin 


More information about the linux-mtd mailing list