On Sun, Apr 02, 2000 at 02:40:52PM -0700, Matthew Dharm wrote:
> What's wrong with this? We need to hold the spinlock to prevent the
> disconnect function from proceeding while we are using the device.
> The spinlock we are holding is a private spinlock. I don't see what you
> think is wrong.
You cannot call anything that calls schedule() while holding
spinlock_irqsave. spinlock without _irqsave would be in my opinion OK,
but schedule() will sti() unconditionally and thus you'll lose the irq
protection.
You do this on other places of usb-storage, too, for example usb_string
on line 1248 calls usb_control_msg which in turn calls schedule(), and
that's done from withing spinlock_irqsave.
It's no fun doing raceless code. I'll have to audit my drivers soon,
too, because I'm sure they're rather full of races, because they do
almost no locking :(
--
Vojtech Pavlik
SuSE Labs
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]