summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_iblock.c
diff options
context:
space:
mode:
authorNicholas Bellinger2015-02-14 02:32:11 +0100
committerNicholas Bellinger2015-02-14 03:09:45 +0100
commitafd73f1b60fc5883ea4982f68e9522e77b28f1e5 (patch)
treec8bfb7f917842b9cc8d0f0f24e71f3be869ba420 /drivers/target/target_core_iblock.c
parenttarget: Fail I/O with PROTECT bit when protection is unsupported (diff)
downloadkernel-qcow2-linux-afd73f1b60fc5883ea4982f68e9522e77b28f1e5.tar.gz
kernel-qcow2-linux-afd73f1b60fc5883ea4982f68e9522e77b28f1e5.tar.xz
kernel-qcow2-linux-afd73f1b60fc5883ea4982f68e9522e77b28f1e5.zip
target: Perform PROTECT sanity checks for WRITE_SAME
This patch adds a call to sbc_check_prot() within sbc_setup_write_same() code to perform the various protection releated sanity checks, including failing if WRPROTECT or RDPROTECT is set for a backend device that has not advertised support for T10-PI. Also, since WRITE_SAME + T10-PI is currently not supported by IBLOCK + FILEIO backends, go ahead and fail if ->execute_write_same() is invoked with a non zero cmd->prot_op. Cc: Martin Petersen <martin.petersen@oracle.com> Cc: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_iblock.c')
-rw-r--r--drivers/target/target_core_iblock.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 3efff94fbd97..303299efa3a6 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -464,6 +464,11 @@ iblock_execute_write_same(struct se_cmd *cmd)
sector_t block_lba = cmd->t_task_lba;
sector_t sectors = sbc_get_write_same_sectors(cmd);
+ if (cmd->prot_op) {
+ pr_err("WRITE_SAME: Protection information with IBLOCK"
+ " backends not supported\n");
+ return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+ }
sg = &cmd->t_data_sg[0];
if (cmd->t_data_nents > 1 ||