summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-07-07 00:26:37 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-07-07 03:07:17 +0200
commit3aa3c67b266fd6114c019bbac35de79aca02d520 (patch)
tree97d9a47c50a077e9e0a15c82c8784fca805e0ad2 /drivers
parenttarget/spc: Set SPT correctly in Extended INQUIRY Data VPD page (diff)
downloadlinux-3aa3c67b266fd6114c019bbac35de79aca02d520.tar.xz
linux-3aa3c67b266fd6114c019bbac35de79aca02d520.zip
target: Add extra TYPE_DISK + protection checks for INQUIRY SPT
Cc: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/target/target_core_spc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 5df4d9b097dc..b5ba1ec3c354 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -454,12 +454,16 @@ spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf)
cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE1_PROT)
buf[4] = 0x5;
else if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE3_PROT ||
- cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE3_PROT)
+ cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE3_PROT)
buf[4] = 0x4;
}
/* logical unit supports type 1 and type 3 protection */
- buf[4] |= (0x3 << 3);
+ if ((dev->transport->get_device_type(dev) == TYPE_DISK) &&
+ (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) &&
+ (dev->dev_attrib.pi_prot_type || cmd->se_sess->sess_prot_type)) {
+ buf[4] |= (0x3 << 3);
+ }
/* Set HEADSUP, ORDSUP, SIMPSUP */
buf[5] = 0x07;