I have a bit of code, which first takes a spinlock with spin_lock_irqsave,
then checks some stuff, and then sleeps on a waitq using
interruptible_sleep_on. in my first implementation i first released the lock
before i called interruptible_sleep_on. I did not do this because the lock
needed to be released, but because i thought the interrupts would be
disabled as long as i held the lock.
but the problem was that after I released the lock, but before i went to
sleep, an interrupt sometimes was handled, which changed some things, and
woke up the queue on which the proces was supposed to be sleeping. this
resulted in a lock because the process went to sleep after this interrupt
i fixed this by not releasing the lock. i just did this to see if my
assumption was right and there would be no interrupt handling. but my
findings where different, the interrupts did came, and everything is going
but now i am very curious why it works. is this because the
spin_lock_irqsave doen's disables interrupts, or because the
interruptible_sleep_on enabled them?