Skip to contentSkip to conversation

scsi: iscsi: Adjuest iface sysfs attr detection

PATCH Applied Baokun Li 3 participants 3 messages Sep 1, 2021 – Sep 14, 2021

Subsystems (2)
lore
Share & tools
lore

Baokun Li

author
#0 lore raw

PATCH 1/1 scsi: iscsi: Adjuest iface sysfs attr detection

ISCSI_NET_PARAM_IFACE_ENABLE belongs to enum iscsi_net_param instead of iscsi_iface_param,so move it to ISCSI_NET_PARAM. Otherwise, when we call into the driver we might not match and return that we don't want attr visible in sysfs. Found in code review.

Fixes e746f3451ec7 ("scsi: iscsi: Fix iface sysfs attr detection")
---
 drivers/scsi/scsi_transport_iscsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +4 -4
index d8b05d8b5470..58027207f08d 100644
@@ -441,9 +441,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
 	struct iscsi_transport *t = iface->transport;
 	int param = -1;
 
-	if (attr == &dev_attr_iface_enabled.attr)
-		param = ISCSI_NET_PARAM_IFACE_ENABLE;
-	else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)
+	if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)
 		param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO;
 	else if (attr == &dev_attr_iface_header_digest.attr)
 		param = ISCSI_IFACE_PARAM_HDRDGST_EN;
@@ -483,7 +481,9 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
 	if (param != -1)
 		return t->attr_is_visible(ISCSI_IFACE_PARAM, param);
 
-	if (attr == &dev_attr_iface_vlan_id.attr)
+	if (attr == &dev_attr_iface_enabled.attr)
+		param = ISCSI_NET_PARAM_IFACE_ENABLE;
+	else if (attr == &dev_attr_iface_vlan_id.attr)
 		param = ISCSI_NET_PARAM_VLAN_ID;
 	else if (attr == &dev_attr_iface_vlan_priority.attr)
 		param = ISCSI_NET_PARAM_VLAN_PRIORITY;
Signature · 1 line
2.31.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Baokun Li

ISCSI_NET_PARAM_IFACE_ENABLE belongs to enum iscsi_net_param instead of iscsi_iface_param,so move it to ISCSI_NET_PARAM. Otherwise, when we call into the driver we might not match and return that we don't want attr visible in sysfs. Found in code review.

Fixes e746f3451ec7 ("scsi: iscsi: Fix iface sysfs attr detection")
---
 drivers/scsi/scsi_transport_iscsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +1 -3
index d8b05d8b5470..58027207f08d 100644
@@ -441,9 +441,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
 	struct iscsi_transport *t = iface->transport;
 	int param = -1;
 
-	if (attr == &dev_attr_iface_enabled.attr)
-		param = ISCSI_NET_PARAM_IFACE_ENABLE;
-	else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)
+	if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)
 		param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO;
 	else if (attr == &dev_attr_iface_header_digest.attr)
 		param = ISCSI_IFACE_PARAM_HDRDGST_EN;

drivers/scsi/scsi_transport_iscsi.c static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, · line 489

Quoted 10 lines
drivers/scsi/scsi_transport_iscsi.c +3 -1
@@ -483,7 +481,9 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
 	if (param != -1)
 		return t->attr_is_visible(ISCSI_IFACE_PARAM, param);
 
-	if (attr == &dev_attr_iface_vlan_id.attr)
+	if (attr == &dev_attr_iface_enabled.attr)
+		param = ISCSI_NET_PARAM_IFACE_ENABLE;
+	else if (attr == &dev_attr_iface_vlan_id.attr)
 		param = ISCSI_NET_PARAM_VLAN_ID;
 	else if (attr == &dev_attr_iface_vlan_priority.attr)
 		param = ISCSI_NET_PARAM_VLAN_PRIORITY;
#2 lore raw
In reply to Baokun Li
Quoted 6 lines · Baokun Li

ISCSI_NET_PARAM_IFACE_ENABLE belongs to enum iscsi_net_param instead of iscsi_iface_param,so move it to ISCSI_NET_PARAM. Otherwise, when we call into the driver we might not match and return that we don't want attr visible in sysfs. Found in code review.

Applied to 5.15/scsi-fixes, thanks!

[1/1] scsi: iscsi: Adjuest iface sysfs attr detection

      https://git.kernel.org/mkp/scsi/c/4e2855082925
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering