On Mon, 2008-03-24 at 15:46 +0100, Jörn Engel wrote:
It would be contended if the initial (on boot) scans of the ports has
failed. This seems to happen when the bus has a lot of devices attached
eg all four ports and some subdevices.
A status command is queued but not processed, and the result is the
device remains locked and can never be accessed.
Here we check whether the queued status command for that port has been
processed. Then trylock - if we take the lock then great, process away,
if we cannot then the unlock the previously taken redundant lock and
reacquire the lock.
OK, it could just use trylock and not give a stuff about the result -
because all we want is a locked queue...but that didn't seem right.
I don't think I have any alternative here. The problem is that the bus
checks periodically (every HZ ticks but that could be changed) if a
device remains connected to the system by queueing a status command. (If
the status command is replied to with a "No response" then that
indicates to the bus that the device has been removed.
But if there is already a command queued for that device (eg a block
read or a block write) then all that would happen is that the commands
get corrupted and an oops ensures.
If I lock the queue for each device then that cannot happen - the bus
driver bounces the status query.
Maple reads and writes are asynchronous of the command being queued - so
the locks are freed when the maple processing is done (ie in another
function). However there is a common unlock point for them all.
--