diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-13 20:32:11 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-13 21:09:45 -0500 |
commit | afd73f1b60fc5883ea4982f68e9522e77b28f1e5 (patch) | |
tree | c8bfb7f917842b9cc8d0f0f24e71f3be869ba420 /drivers/target/target_core_file.c | |
parent | f7b7c06f386c5e990acb87a8bc96137b9f978977 (diff) |
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_file.c')
-rw-r--r-- | drivers/target/target_core_file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index c2aea099ea4a..9f1ed773e976 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -494,6 +494,11 @@ fd_execute_write_same(struct se_cmd *cmd) | |||
494 | target_complete_cmd(cmd, SAM_STAT_GOOD); | 494 | target_complete_cmd(cmd, SAM_STAT_GOOD); |
495 | return 0; | 495 | return 0; |
496 | } | 496 | } |
497 | if (cmd->prot_op) { | ||
498 | pr_err("WRITE_SAME: Protection information with FILEIO" | ||
499 | " backends not supported\n"); | ||
500 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
501 | } | ||
497 | sg = &cmd->t_data_sg[0]; | 502 | sg = &cmd->t_data_sg[0]; |
498 | 503 | ||
499 | if (cmd->t_data_nents > 1 || | 504 | if (cmd->t_data_nents > 1 || |