aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-18 21:40:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-18 21:40:38 -0400
commit8a7298b7805ab55dea674a8aba97cf2eac20dca8 (patch)
treedf70be879baf18a0d767f19268991e5104ddee6f
parentb1bdd2eb31309a3b61235613041180cd50be19a0 (diff)
parent1765fe5edcb83f53fc67edeb559fcf4bc82c6460 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull target fixes from Nicholas Bellinger: "This includes a bugfix from MDR to address a NULL pointer OOPs with FCoE aborts, along with a WRITE_SAME emulation bugfix for NOLB=0 cases, and persistent reservation return cleanups from Roland. All three patches are CC'ed to stable." * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: target: Fix range calculation in WRITE SAME emulation when num blocks == 0 target: Clean up returning errors in PR handling code tcm_fc: Fix crash seen with aborts and large reads
-rw-r--r--drivers/target/target_core_cdb.c2
-rw-r--r--drivers/target/target_core_pr.c7
-rw-r--r--drivers/target/tcm_fc/tfc_cmd.c2
3 files changed, 7 insertions, 4 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
index 9888693a18fe..664f6e775d0e 100644
--- a/drivers/target/target_core_cdb.c
+++ b/drivers/target/target_core_cdb.c
@@ -1095,7 +1095,7 @@ int target_emulate_write_same(struct se_cmd *cmd)
1095 if (num_blocks != 0) 1095 if (num_blocks != 0)
1096 range = num_blocks; 1096 range = num_blocks;
1097 else 1097 else
1098 range = (dev->transport->get_blocks(dev) - lba); 1098 range = (dev->transport->get_blocks(dev) - lba) + 1;
1099 1099
1100 pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n", 1100 pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n",
1101 (unsigned long long)lba, (unsigned long long)range); 1101 (unsigned long long)lba, (unsigned long long)range);
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 85564998500a..a1bcd927a9e6 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -2031,7 +2031,7 @@ static int __core_scsi3_write_aptpl_to_file(
2031 if (IS_ERR(file) || !file || !file->f_dentry) { 2031 if (IS_ERR(file) || !file || !file->f_dentry) {
2032 pr_err("filp_open(%s) for APTPL metadata" 2032 pr_err("filp_open(%s) for APTPL metadata"
2033 " failed\n", path); 2033 " failed\n", path);
2034 return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT); 2034 return IS_ERR(file) ? PTR_ERR(file) : -ENOENT;
2035 } 2035 }
2036 2036
2037 iov[0].iov_base = &buf[0]; 2037 iov[0].iov_base = &buf[0];
@@ -3818,7 +3818,7 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd)
3818 " SPC-2 reservation is held, returning" 3818 " SPC-2 reservation is held, returning"
3819 " RESERVATION_CONFLICT\n"); 3819 " RESERVATION_CONFLICT\n");
3820 cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; 3820 cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
3821 ret = EINVAL; 3821 ret = -EINVAL;
3822 goto out; 3822 goto out;
3823 } 3823 }
3824 3824
@@ -3828,7 +3828,8 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd)
3828 */ 3828 */
3829 if (!cmd->se_sess) { 3829 if (!cmd->se_sess) {
3830 cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 3830 cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
3831 return -EINVAL; 3831 ret = -EINVAL;
3832 goto out;
3832 } 3833 }
3833 3834
3834 if (cmd->data_length < 24) { 3835 if (cmd->data_length < 24) {
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index f03fb9730f5b..5b65f33939a8 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -230,6 +230,8 @@ u32 ft_get_task_tag(struct se_cmd *se_cmd)
230{ 230{
231 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); 231 struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);
232 232
233 if (cmd->aborted)
234 return ~0;
233 return fc_seq_exch(cmd->seq)->rxid; 235 return fc_seq_exch(cmd->seq)->rxid;
234} 236}
235 237