diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-14 05:29:50 +0300 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-14 05:54:48 +0300 |
commit | 61fdb4acc8411bf50589bc67431ad12e21e7678a (patch) | |
tree | 632d2dced5bd55fa3026665a356c7e9ff20b483a /drivers/target/target_core_sbc.c | |
parent | d0a91295557666f9e58b79b5177a98229007803b (diff) | |
download | linux-61fdb4acc8411bf50589bc67431ad12e21e7678a.tar.xz |
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>
Diffstat (limited to 'drivers/target/target_core_sbc.c')
-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) if (!ops->execute_unmap) return TCM_UNSUPPORTED_SCSI_OPCODE; + if (!dev->dev_attrib.emulate_tpu) { + pr_err("Got UNMAP, but backend device has" + " emulate_tpu disabled\n"); + return TCM_UNSUPPORTED_SCSI_OPCODE; + } size = get_unaligned_be16(&cdb[7]); cmd->execute_cmd = ops->execute_unmap; break; |