diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-13 21:29:50 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-13 21:54:48 -0500 |
commit | 61fdb4acc8411bf50589bc67431ad12e21e7678a (patch) | |
tree | 632d2dced5bd55fa3026665a356c7e9ff20b483a | |
parent | d0a91295557666f9e58b79b5177a98229007803b (diff) |
target: Fail UNMAP when emulate_tpu=0
This patch adds a check within sbc_parse_cdb() to fail a UNMAP op,
if the backend device has emulate_tpu disabled.
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_sbc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 0d307c34f08e..9661a6626b2d 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -962,6 +962,11 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | |||
962 | if (!ops->execute_unmap) | 962 | if (!ops->execute_unmap) |
963 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 963 | return TCM_UNSUPPORTED_SCSI_OPCODE; |
964 | 964 | ||
965 | if (!dev->dev_attrib.emulate_tpu) { | ||
966 | pr_err("Got UNMAP, but backend device has" | ||
967 | " emulate_tpu disabled\n"); | ||
968 | return TCM_UNSUPPORTED_SCSI_OPCODE; | ||
969 | } | ||
965 | size = get_unaligned_be16(&cdb[7]); | 970 | size = get_unaligned_be16(&cdb[7]); |
966 | cmd->execute_cmd = ops->execute_unmap; | 971 | cmd->execute_cmd = ops->execute_unmap; |
967 | break; | 972 | break; |