Skip to contentSkip to conversation

target: make the pi_prot_format ConfigFS path readable

PATCH Applied David Disseldorp 3 participants 3 messages Feb 4, 2019 – Feb 5, 2019 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target: make the pi_prot_format ConfigFS path readable

pi_prot_format conversion to write-only caused userspace breakage. Make the ConfigFS path readable again and hardcode the "0\n" content, matching previous output.

Fixes 6baca7601bde ("scsi: target: drop unused pi_prot_format attribute storage")
---
 drivers/target/target_core_configfs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/target/target_core_configfs.c +7 -1
index 72016d0dfca5..8e7fffbb8802 100644
@@ -852,6 +852,12 @@ static ssize_t pi_prot_type_store(struct config_item *item,
 	return count;
 }
 
+/* always zero, but attr needs to remain RW to avoid userspace breakage */
+static ssize_t pi_prot_format_show(struct config_item *item, char *page)
+{
+	return snprintf(page, PAGE_SIZE, "0\n");
+}
+
 static ssize_t pi_prot_format_store(struct config_item *item,
 		const char *page, size_t count)
 {
@@ -1132,7 +1138,7 @@ CONFIGFS_ATTR(, emulate_3pc);
 CONFIGFS_ATTR(, emulate_pr);
 CONFIGFS_ATTR(, pi_prot_type);
 CONFIGFS_ATTR_RO(, hw_pi_prot_type);
-CONFIGFS_ATTR_WO(, pi_prot_format);
+CONFIGFS_ATTR(, pi_prot_format);
 CONFIGFS_ATTR(, pi_prot_verify);
 CONFIGFS_ATTR(, enforce_pr_isids);
 CONFIGFS_ATTR(, is_nonrot);
Signature · 1 line
2.13.7
#1 lore raw

David,

Quoted 3 lines

pi_prot_format conversion to write-only caused userspace breakage. Make the ConfigFS path readable again and hardcode the "0\n" content, matching previous output.

Applied to 5.0/scsi-fixes, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
Reviewed-by on v1 1/1
#2 lore raw
In reply to David Disseldorp
Quoted 9 lines · David Disseldorp

pi_prot_format conversion to write-only caused userspace breakage. Make the ConfigFS path readable again and hardcode the "0\n" content, matching previous output.

Fixes 6baca7601bde ("scsi: target: drop unused pi_prot_format attribute storage")