aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2011-06-13 23:55:06 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-07-22 05:37:45 -0400
commit56e34ee2adb59a35bfa5714bdf4dcb3f4d14a41d (patch)
tree80ab54908f9cd603ef26cdcc634e70ddd34c6640
parent78faae37897dc2a9ccc7c19155294a4bfdcae077 (diff)
target: Make se_dev_check_online() locking IRQ-safe
se_dev_check_online() is called from transport_lookup_cmd_lun(), which as discussed before may be called from interrupt context. So it needs to use spin_lock_irqsave() instead of spin_lock_irq() to avoid enabling interrupts at the wrong time. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_device.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index e25df3b813e5..6d93d9684cfc 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -813,12 +813,13 @@ static void se_dev_stop(struct se_device *dev)
813 813
814int se_dev_check_online(struct se_device *dev) 814int se_dev_check_online(struct se_device *dev)
815{ 815{
816 unsigned long flags;
816 int ret; 817 int ret;
817 818
818 spin_lock_irq(&dev->dev_status_lock); 819 spin_lock_irqsave(&dev->dev_status_lock, flags);
819 ret = ((dev->dev_status & TRANSPORT_DEVICE_ACTIVATED) || 820 ret = ((dev->dev_status & TRANSPORT_DEVICE_ACTIVATED) ||
820 (dev->dev_status & TRANSPORT_DEVICE_DEACTIVATED)) ? 0 : 1; 821 (dev->dev_status & TRANSPORT_DEVICE_DEACTIVATED)) ? 0 : 1;
821 spin_unlock_irq(&dev->dev_status_lock); 822 spin_unlock_irqrestore(&dev->dev_status_lock, flags);
822 823
823 return ret; 824 return ret;
824} 825}