Skip to contentSkip to conversation

scsi: iscsi: special case for GET_HOST_STATS

PATCH In review Xiang Zhang 3 participants 7 messages Jan 3, 2025 – Jan 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: iscsi: special case for GET_HOST_STATS

Special case for ISCSI_UEVENT_GET_HOST_STATS:
- On success: send reply and stats from iscsi_get_host_stats() within if_recv_msg().
- On error: fall through.

---
 drivers/scsi/scsi_transport_iscsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +2 -0
index fde7de3b1e55..ad4186da1cb4 100644
@@ -4113,6 +4113,8 @@ iscsi_if_rx(struct sk_buff *skb)
 				break;
 			if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
 				break;
+			if (ev->type == ISCSI_UEVENT_GET_HOST_STATS && !err)
+				break;
 			err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
 						  ev, sizeof(*ev));
 			if (err == -EAGAIN && --retries < 0) {
Signature · 1 line
2.44.0
#1 lore raw
Quoted 4 lines · Xiang Zhang

Special case for ISCSI_UEVENT_GET_HOST_STATS:
- On success: send reply and stats from iscsi_get_host_stats() within if_recv_msg().
- On error: fall through.

Could you add a line about what is being fixed? The above info describes how you fixed it.

drivers/scsi/scsi_transport_iscsi.c iscsi_if_rx(struct sk_buff *skb)

Quoted 10 lines
Quoted 1 line
---
 drivers/scsi/scsi_transport_iscsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +0 -0
index fde7de3b1e55..ad4186da1cb4 100644
@@ -4113,6 +4113,8 @@ iscsi_if_rx(struct sk_buff *skb)

Patch looks correct, but could you update the code comment right above this line so it mentions ISCSI_UEVENT_GET_STATS and ISCSI_UEVENT_GET_HOST_STATS.

Quoted 8 lines
drivers/scsi/scsi_transport_iscsi.c +2 -0
 				break;
 			if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
 				break;
+			if (ev->type == ISCSI_UEVENT_GET_HOST_STATS && !err)
+				break;
 			err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
 						  ev, sizeof(*ev));
 			if (err == -EAGAIN && --retries < 0) {
#2 lore raw

PATCH v2 1/1 scsi: iscsi: Fix redundant response for ISCSI_UEVENT_GET_HOST_STATS request

The ISCSI_UEVENT_GET_HOST_STATS request is already replied to iscsid in iscsi_get_host_stats, This fix ensures that redundant responses are skipped in iscsi_if_rx.
- On success: send reply and stats from iscsi_get_host_stats()
within if_recv_msg().
- On error: fall through.

---
V1 -> V2: Update commit message

---
 drivers/scsi/scsi_transport_iscsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +2 -0
index fde7de3b1e55..ad4186da1cb4 100644
@@ -4113,6 +4113,8 @@ iscsi_if_rx(struct sk_buff *skb)
 				break;
 			if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
 				break;
+			if (ev->type == ISCSI_UEVENT_GET_HOST_STATS && !err)
+				break;
 			err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
 						  ev, sizeof(*ev));
 			if (err == -EAGAIN && --retries < 0) {
Signature · 1 line
2.44.0
maintainer
#3 lore raw

Re: [PATCH v2] scsi: iscsi: Fix redundant response for ISCSI_UEVENT_GET_HOST_STATS request

Quoted 1 line · Xiang Zhang

The ISCSI_UEVENT_GET_HOST_STATS request is already replied to iscsid in iscsi_get_host_stats,

The lines are too long. You need to keep them shorter than 75 columns in the commit message.

You can quickly check your patch by running:

src/linux$ scripts/checkpatch.pl your-patch.patch

Also don't forget the code comment below.

Review iscsi_if_rx(struct sk_buff *skb) · line 4113

Quoted 2 lines
(quoted diff) +0 -0
@@ -4113,6 +4113,8 @@ iscsi_if_rx(struct sk_buff *skb)
 				break;

Thanks for the update, but I think you missed the previous email:

Patch looks correct, but could you update the code comment right above this line so it mentions ISCSI_UEVENT_GET_STATS and ISCSI_UEVENT_GET_HOST_STATS.

Quoted 7 lines
drivers/scsi/scsi_transport_iscsi.c +2 -0
 			if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
 				break;
+			if (ev->type == ISCSI_UEVENT_GET_HOST_STATS && !err)
+				break;
 			err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
 						  ev, sizeof(*ev));
 			if (err == -EAGAIN && --retries < 0) {
#4 lore raw

PATCH v3 1/1 scsi: iscsi: Fix redundant response for ISCSI_UEVENT_GET_HOST_STATS request

The ISCSI_UEVENT_GET_HOST_STATS request is already replied to iscsid in iscsi_get_host_stats. This fix ensures that redundant responses are skipped in iscsi_if_rx.
- On success: send reply and stats from iscsi_get_host_stats() within if_recv_msg().
- On error: fall through.

---
V2 -> V3: Update code comments
V1 -> V2: Update commit message

---
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_iscsi.c +3 -1
index fde7de3b1e55..9b47f91c5b97 100644
@@ -4104,7 +4104,7 @@ iscsi_if_rx(struct sk_buff *skb)
 		}
 		do {
 			/*
-			 * special case for GET_STATS:
+			 * special case for GET_STATS, GET_CHAP and GET_HOST_STATS:
 			 * on success - sending reply and stats from
 			 * inside of if_recv_msg(),
 			 * on error - fall through.
@@ -4113,6 +4113,8 @@ iscsi_if_rx(struct sk_buff *skb)
 				break;
 			if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
 				break;
+			if (ev->type == ISCSI_UEVENT_GET_HOST_STATS && !err)
+				break;
 			err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
 						  ev, sizeof(*ev));
 			if (err == -EAGAIN && --retries < 0) {
Signature · 1 line
2.44.0
maintainer Reviewed-by on v3 1/1
#5 lore raw

Re: [PATCH v3] scsi: iscsi: Fix redundant response for ISCSI_UEVENT_GET_HOST_STATS request

Quoted 8 lines · Xiang Zhang

The ISCSI_UEVENT_GET_HOST_STATS request is already replied to iscsid in iscsi_get_host_stats. This fix ensures that redundant responses are skipped in iscsi_if_rx.
- On success: send reply and stats from iscsi_get_host_stats() within if_recv_msg().
- On error: fall through.

Thanks for fixing this.

#6 lore raw

Re: [PATCH v3] scsi: iscsi: Fix redundant response for ISCSI_UEVENT_GET_HOST_STATS request

In reply to Xiang Zhang
Quoted 8 lines · Xiang Zhang

The ISCSI_UEVENT_GET_HOST_STATS request is already replied to iscsid in iscsi_get_host_stats. This fix ensures that redundant responses are skipped in iscsi_if_rx.
- On success: send reply and stats from iscsi_get_host_stats() within if_recv_msg().
- On error: fall through.

[...]

Applied to 6.13/scsi-fixes, thanks!

[1/1] scsi: iscsi: Fix redundant response for ISCSI_UEVENT_GET_HOST_STATS request

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