aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <mchristi@redhat.com>2017-07-10 15:53:31 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2017-07-10 23:05:27 -0400
commitc17d5d5f51f72f24e0e17a4450ae5010bf6962d9 (patch)
treeb03a0c7110d5f3e0d1b36deac77abe38b886842a
parent7ee0031786dc3762f61d0ec9171bb75d56a5ac76 (diff)
target: export lio pgr/alua support as device attr
Older kernels could crash or hang if the user write/read some ALUA files with pscsi and tcmu backends. This patch exports if LIO supports executing PGR and ALUA scsi commands/checks for the se_device, so userspace can easily test. Signed-off-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_configfs.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 9b8abd55c21c..7e87d952bb7a 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1085,6 +1085,24 @@ static ssize_t block_size_store(struct config_item *item,
1085 return count; 1085 return count;
1086} 1086}
1087 1087
1088static ssize_t alua_support_show(struct config_item *item, char *page)
1089{
1090 struct se_dev_attrib *da = to_attrib(item);
1091 u8 flags = da->da_dev->transport->transport_flags;
1092
1093 return snprintf(page, PAGE_SIZE, "%d\n",
1094 flags & TRANSPORT_FLAG_PASSTHROUGH_ALUA ? 0 : 1);
1095}
1096
1097static ssize_t pgr_support_show(struct config_item *item, char *page)
1098{
1099 struct se_dev_attrib *da = to_attrib(item);
1100 u8 flags = da->da_dev->transport->transport_flags;
1101
1102 return snprintf(page, PAGE_SIZE, "%d\n",
1103 flags & TRANSPORT_FLAG_PASSTHROUGH_PGR ? 0 : 1);
1104}
1105
1088CONFIGFS_ATTR(, emulate_model_alias); 1106CONFIGFS_ATTR(, emulate_model_alias);
1089CONFIGFS_ATTR(, emulate_dpo); 1107CONFIGFS_ATTR(, emulate_dpo);
1090CONFIGFS_ATTR(, emulate_fua_write); 1108CONFIGFS_ATTR(, emulate_fua_write);
@@ -1116,6 +1134,8 @@ CONFIGFS_ATTR(, unmap_granularity);
1116CONFIGFS_ATTR(, unmap_granularity_alignment); 1134CONFIGFS_ATTR(, unmap_granularity_alignment);
1117CONFIGFS_ATTR(, unmap_zeroes_data); 1135CONFIGFS_ATTR(, unmap_zeroes_data);
1118CONFIGFS_ATTR(, max_write_same_len); 1136CONFIGFS_ATTR(, max_write_same_len);
1137CONFIGFS_ATTR_RO(, alua_support);
1138CONFIGFS_ATTR_RO(, pgr_support);
1119 1139
1120/* 1140/*
1121 * dev_attrib attributes for devices using the target core SBC/SPC 1141 * dev_attrib attributes for devices using the target core SBC/SPC
@@ -1154,6 +1174,8 @@ struct configfs_attribute *sbc_attrib_attrs[] = {
1154 &attr_unmap_granularity_alignment, 1174 &attr_unmap_granularity_alignment,
1155 &attr_unmap_zeroes_data, 1175 &attr_unmap_zeroes_data,
1156 &attr_max_write_same_len, 1176 &attr_max_write_same_len,
1177 &attr_alua_support,
1178 &attr_pgr_support,
1157 NULL, 1179 NULL,
1158}; 1180};
1159EXPORT_SYMBOL(sbc_attrib_attrs); 1181EXPORT_SYMBOL(sbc_attrib_attrs);
@@ -1168,6 +1190,8 @@ struct configfs_attribute *passthrough_attrib_attrs[] = {
1168 &attr_hw_block_size, 1190 &attr_hw_block_size,
1169 &attr_hw_max_sectors, 1191 &attr_hw_max_sectors,
1170 &attr_hw_queue_depth, 1192 &attr_hw_queue_depth,
1193 &attr_alua_support,
1194 &attr_pgr_support,
1171 NULL, 1195 NULL,
1172}; 1196};
1173EXPORT_SYMBOL(passthrough_attrib_attrs); 1197EXPORT_SYMBOL(passthrough_attrib_attrs);