dm: fix locking context in queue_io()
authorKiyoshi Ueda <k-ueda@ct.jp.nec.com>
Wed, 8 Sep 2010 16:07:01 +0000 (18:07 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Fri, 10 Sep 2010 10:35:38 +0000 (12:35 +0200)
Now queue_io() is called from dec_pending(), which may be called with
interrupts disabled, so queue_io() must not enable interrupts
unconditionally and must save/restore the current interrupts status.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
drivers/md/dm.c

index 2011704b8ba0ca515159dfec69552c46c942162e..cd2f7e77b625d2f4fb8de89f91af1cd86e39c7bd 100644 (file)
@@ -512,9 +512,11 @@ static void end_io_acct(struct dm_io *io)
  */
 static void queue_io(struct mapped_device *md, struct bio *bio)
 {
-       spin_lock_irq(&md->deferred_lock);
+       unsigned long flags;
+
+       spin_lock_irqsave(&md->deferred_lock, flags);
        bio_list_add(&md->deferred, bio);
-       spin_unlock_irq(&md->deferred_lock);
+       spin_unlock_irqrestore(&md->deferred_lock, flags);
        queue_work(md->wq, &md->work);
 }