diff options
author | Roland Dreier <roland@purestorage.com> | 2011-06-14 03:55:06 (GMT) |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 09:37:45 (GMT) |
commit | 56e34ee2adb59a35bfa5714bdf4dcb3f4d14a41d (patch) | |
tree | 80ab54908f9cd603ef26cdcc634e70ddd34c6640 | |
parent | 78faae37897dc2a9ccc7c19155294a4bfdcae077 (diff) | |
download | linux-56e34ee2adb59a35bfa5714bdf4dcb3f4d14a41d.tar.xz |
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.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index e25df3b..6d93d96 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) int se_dev_check_online(struct se_device *dev) { + unsigned long flags; int ret; - spin_lock_irq(&dev->dev_status_lock); + spin_lock_irqsave(&dev->dev_status_lock, flags); ret = ((dev->dev_status & TRANSPORT_DEVICE_ACTIVATED) || (dev->dev_status & TRANSPORT_DEVICE_DEACTIVATED)) ? 0 : 1; - spin_unlock_irq(&dev->dev_status_lock); + spin_unlock_irqrestore(&dev->dev_status_lock, flags); return ret; } |