Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Linus Torvalds committed Jul 19, 2012
2 parents b1bdd2e + 1765fe5 commit 8a7298b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/target/target_core_cdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ int target_emulate_write_same(struct se_cmd *cmd)
if (num_blocks != 0)
range = num_blocks;
else
range = (dev->transport->get_blocks(dev) - lba);
range = (dev->transport->get_blocks(dev) - lba) + 1;

pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n",
(unsigned long long)lba, (unsigned long long)range);
Expand Down
7 changes: 4 additions & 3 deletions drivers/target/target_core_pr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ static int __core_scsi3_write_aptpl_to_file(
if (IS_ERR(file) || !file || !file->f_dentry) {
pr_err("filp_open(%s) for APTPL metadata"
" failed\n", path);
return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT);
return IS_ERR(file) ? PTR_ERR(file) : -ENOENT;
}

iov[0].iov_base = &buf[0];
Expand Down Expand Up @@ -3818,7 +3818,7 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd)
" SPC-2 reservation is held, returning"
" RESERVATION_CONFLICT\n");
cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
ret = EINVAL;
ret = -EINVAL;
goto out;
}

Expand All @@ -3828,7 +3828,8 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd)
*/
if (!cmd->se_sess) {
cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -EINVAL;
ret = -EINVAL;
goto out;
}

if (cmd->data_length < 24) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/target/tcm_fc/tfc_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ u32 ft_get_task_tag(struct se_cmd *se_cmd)
{
struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);

if (cmd->aborted)
return ~0;
return fc_seq_exch(cmd->seq)->rxid;
}

Expand Down

0 comments on commit 8a7298b

Please sign in to comment.