summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_device.c
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2011-07-20 09:28:56 +0000
committerNicholas Bellinger <nab@linux-iscsi.org>2011-07-22 09:37:45 +0000
commit5e1be919820175a2becc3c72051050aaa3fae954 (patch)
tree50b987bb753e481fd0d921e5723deacd17f5a97f /drivers/target/target_core_device.c
parent56e34ee2adb59a35bfa5714bdf4dcb3f4d14a41d (diff)
downloadlinux-5e1be919820175a2becc3c72051050aaa3fae954.tar.gz
linux-5e1be919820175a2becc3c72051050aaa3fae954.tar.xz
linux-5e1be919820175a2becc3c72051050aaa3fae954.zip
target: Make se_tmr_lock IRQ-safe
transport_lookup_tmr_lun() can be called from interrupt context and therefore needs to use IRQ-safe spinlock functions. Fix this up, and to make the locking work, convert the other uses of se_tmr_lock to be IRQ-disabling. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r--drivers/target/target_core_device.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 6d93d9684cfc..f13e2941936c 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -181,6 +181,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
struct se_lun *se_lun = NULL;
struct se_session *se_sess = se_cmd->se_sess;
struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
+ unsigned long flags;
if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) {
se_cmd->scsi_sense_reason = TCM_NON_EXISTENT_LUN;
@@ -188,7 +189,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
return -ENODEV;
}
- spin_lock_irq(&se_sess->se_node_acl->device_list_lock);
+ spin_lock_irqsave(&se_sess->se_node_acl->device_list_lock, flags);
se_cmd->se_deve = &se_sess->se_node_acl->device_list[unpacked_lun];
deve = se_cmd->se_deve;
@@ -200,7 +201,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
se_cmd->orig_fe_lun = unpacked_lun;
se_cmd->se_orig_obj_ptr = se_cmd->se_dev;
}
- spin_unlock_irq(&se_sess->se_node_acl->device_list_lock);
+ spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags);
if (!se_lun) {
printk(KERN_INFO "TARGET_CORE[%s]: Detected NON_EXISTENT_LUN"
@@ -223,9 +224,9 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun)
se_cmd->se_dev = se_lun->lun_se_dev;
se_tmr->tmr_dev = se_lun->lun_se_dev;
- spin_lock(&se_tmr->tmr_dev->se_tmr_lock);
+ spin_lock_irqsave(&se_tmr->tmr_dev->se_tmr_lock, flags);
list_add_tail(&se_tmr->tmr_list, &se_tmr->tmr_dev->dev_tmr_list);
- spin_unlock(&se_tmr->tmr_dev->se_tmr_lock);
+ spin_unlock_irqrestore(&se_tmr->tmr_dev->se_tmr_lock, flags);
return 0;
}