[dm-devel] [PATCH] dm-block-manager: use spinlocks that don't disable interrupts

Joe Thornber thornber at redhat.com
Mon Sep 12 14:11:00 UTC 2011


On Mon, Sep 12, 2011 at 09:57:42AM -0400, Christoph Hellwig wrote:
> On Mon, Sep 12, 2011 at 07:24:48AM -0400, Mikulas Patocka wrote:
> > dm-block-manager: use spinlocks that don't disable interrupts
> > 
> > This will never be called in an interrupt context, so we don't have to use
> > spinlocks that disable interrupts.
> 
> The code looks like a re-implementation of rw_semaphores to me.
> 
> Is there any good reason to do this? (hint: normally there isn't :))

Yes, largely it is.  The major difference is it errors on recursive
use (which can occur due to malicious metadata as well as programming
errors).  This is far better than deadlocking (which rwsemaphores to),
livelocking (which no-locking may do), or not noticing something's
wrong (which no-locking may do).

I can understand that people may well want to turn locking off to get
the better performance.  So there's a Kconfig option for this.

- Joe




More information about the dm-devel mailing list