Hi Arshad, On Thu, 2014-03-06 at 15:42 +0530, Arshad Hussain wrote: > Hi, > > I am looking for help in understanding how LIO processes/handles NopOUT. > The problem which I noticed is that LIO Ignores NopOut->flags field > while processing nop out. > Looking at RFC Section 10.18 the NopOUT->flags LMB (Left most bit) > Must be set which LIO is ignoring. > > 10.18. NOP-Out > > Byte/ 0 | 1 | 2 | 3 | > / | | | | > |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| > +---------------+---------------+---------------+---------------+ > 0|.|I| 0x00 |1| Reserved | > +---------------+---------------+---------------+---------------+ > > I understand it is the onus of the Initiator to set set proper flags for > NopOUT, > However if the initiator fails to set it correctly. This flag is > ignored, by LIO > and I understand is a RFC error. > > I made changes to the LIO source to confirm my findings. Hope you will find > my experiments useful. > Thanks for the feedback. I'd be happy to take a patch to add the explicit check for the F_BIT here.. Comments below.. > Thanks > Arshad > > --- ./iscsi_target.c 2014-03-06 02:26:26.830460677 -0500 > +++ ./drivers/target/iscsi/iscsi_target.c 2014-03-06 > 04:04:07.074341573 -0500 > @@ -1568,10 +1568,22 @@ > { > struct iscsi_cmd *cmd_p = NULL; > int cmdsn_ret = 0; > + pr_err("#D1 - Testing if hitting the correct function.\n"); > + pr_err("#D2 - opcode = [%x]\n",hdr->opcode); > + pr_err("#D3 - flags = [%x]\n",hdr->flags); > + pr_err("#D3 - TTT = [%x]\n",hdr->ttt); > /* > * Initiator is expecting a NopIN ping reply.. > */ > > + /* > + * RFC Section 10.18 Mandates NopOUT Flag's LMB to be set > + */ > + if ( !(hdr->flags & 0x80) ) { > + pr_err("#D4 - NopOUT Flag LMB not set.\n"); > + return -1; > + } > + So this check should move into iscsit_setup_nop_out(), and should call iscsit_reject_cmd() with ISCSI_REASON_PROTOCOL_ERROR before returning. Also, you'll want to use the ISCSI_FLAG_CMD_FINAL macro instead of hardcoding '0x80' here. Care to post a proper patch with these comments addressed..? --nab -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html