Message ID | EDBAAA0BBBA2AC4E9C8B6B81DEEE1D6915DFA0FE@dggeml505-mbs.china.huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] scsi: avoid potential deadloop in iscsi_if_rx func | expand |
>>> "wubo (T)" <wubo40@huawei.com> schrieb am 30.10.2019 um 08:56 in Nachricht <EDBAAA0BBBA2AC4E9C8B6B81DEEE1D6915DFA0FE@dggeml505-mbs.china.huawei.com>: > From: Bo Wu <wubo40@huawei.com> ... > + if (--retries < 0) { > + printk(KERN_ERR "Send reply failed too many times. " > + "Max supported retries %u\n", ISCSI_SEND_MAX_ALLOWED); Just for "personal taste": Why not simplify the message to:? + printk(KERN_ERR "Send reply failed too many times (%u)\n", ISCSI_SEND_MAX_ALLOWED); > + break; > + } > + Maybe place the number after "many" as an alternative. I think as the message is expected to be rare, a short variant is justified. Also one could discuss wether the problem that originates "from external" should be KERN_ERR, or maybe just a warning, because the kernel itself can do little against that problem, and it's not a "kernel error" after all ;-) Regards, Ulrich
> >>> "wubo (T)" <wubo40@huawei.com> schrieb am 30.10.2019 um 08:56 in > Nachricht > <EDBAAA0BBBA2AC4E9C8B6B81DEEE1D6915DFA0FE@dggeml505-mbs.china. > huawei.com>: > > From: Bo Wu <wubo40@huawei.com> > > ... > > + if (--retries < 0) { > > + printk(KERN_ERR "Send reply failed too many times. " > > + "Max supported retries %u\n", > ISCSI_SEND_MAX_ALLOWED); > > Just for "personal taste": Why not simplify the message to:? > + printk(KERN_ERR "Send reply failed too many times > (%u)\n", > ISCSI_SEND_MAX_ALLOWED); > > > + break; > > + } > > + > > Maybe place the number after "many" as an alternative. I think as the > message is expected to be rare, a short variant is justified. Thanks for your suggestion. This problem occured when iscsi_if_send_reply returns -EAGAIN. Consider possible other anomalies scenes. In order to get diagnostic information, it is better to replace "many" with error code. Modify as follow: if (--retries < 0) { printk(KERN_WARNING "Send reply failed, error %d\n", err); break; } > Also one could discuss wether the problem that originates "from external" > should be KERN_ERR, or maybe just a warning, because the kernel itself can do > little against that problem, and it's not a "kernel error" after all ;-) You are right, This problem scene rarely appears .it is friendly to replace the error with warning. > > Regards, > Ulrich > > > Thanks, Bo Wu
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 417b868d8735..85482bcfc727 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -24,6 +24,8 @@ #define ISCSI_TRANSPORT_VERSION "2.0-870" +#define ISCSI_SEND_MAX_ALLOWED 10 + #define CREATE_TRACE_POINTS #include <trace/events/iscsi.h> @@ -3682,6 +3684,7 @@ iscsi_if_rx(struct sk_buff *skb) struct nlmsghdr *nlh; struct iscsi_uevent *ev; uint32_t group; + int retries = ISCSI_SEND_MAX_ALLOWED; nlh = nlmsg_hdr(skb); if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) || @@ -3710,6 +3713,16 @@ iscsi_if_rx(struct sk_buff *skb)