提交 56e34ee2 编写于 作者: R Roland Dreier 提交者: Nicholas Bellinger

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: NRoland Dreier <roland@purestorage.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 78faae37
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册