Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312695
b: refs/heads/master
c: 2594e29
h: refs/heads/master
i:
  312693: 14a1894
  312691: a0fdf16
  312687: d8f74a3
v: v3
  • Loading branch information
Roland Dreier authored and Nicholas Bellinger committed Jul 17, 2012
1 parent 834dd1f commit 59d1b76
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e2397c704429025bc6b331a970f699e52f34283e
refs/heads/master: 2594e29865c291db162313187612cd9f14538f33
12 changes: 12 additions & 0 deletions trunk/drivers/target/target_core_iblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,18 @@ static int iblock_execute_unmap(struct se_cmd *cmd)
pr_debug("UNMAP: Using lba: %llu and range: %u\n",
(unsigned long long)lba, range);

if (range > dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count) {
cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
ret = -EINVAL;
goto err;
}

if (lba + range > dev->transport->get_blocks(dev) + 1) {
cmd->scsi_sense_reason = TCM_ADDRESS_OUT_OF_RANGE;
ret = -EINVAL;
goto err;
}

ret = blkdev_issue_discard(ibd->ibd_bd, lba, range,
GFP_KERNEL, 0);
if (ret < 0) {
Expand Down

0 comments on commit 59d1b76

Please sign in to comment.