Quote:> What is the difference between read_lock_bh(), read_lock_irq(), and
> read_lock() as available in spinlock.h?
They all take a rw spin lock for reading.
read_lock doesn't protect you again interrupts. You have to make sure
no interrupt will try to grab the same lock.
read_lock_bh works as read_lock, but also protects you against software
interrupts and tasklets.
read_lock_irq works as read_lock, but also protects you against hardware
interrupts and software interrupts too. This is needed if the interrupts
can access the same lock, otherwise you risk dead lock. One trap is that
its release function (read_unlock_irq) will unconditionally turn on interrupts
again. If you turned them off previously this may be not intended.
So the recommended function to use instead of read_lock_irq is
read_lock_irqsave, which saves the old interrupt enabled flag.
-Andi