"Luiz Angelo Daros de Luca" <luizluca@...> writes:
> Helllo,
>
> build_inquiry_response in target_disk.c:150 runs even if there is no
> LUN associated. There is some treatment like:
>
> 204 } else if (scb[2] == 0x80) {
> 205 int len = (cmnd->lun && strlen(cmnd->lun->scsi_sn)) ?
> 206 SCSI_SN_LEN : 4;
> 207
> 208 data[1] = 0x80;
>
> or
>
> 230 data[5] = 0x1;
> 231 data[7] = len;
> 232 if (cmnd->lun) /* We need this ? */
> 233 memcpy(data + 8, cmnd->lun->scsi_id, len);
>
> Answering the question, yes, we need this.
> And, at the end we have
>
> 239 tio_set(tio, min_t(u8, tio->size, scb[4]), 0);
> 240 if (!cmnd->lun)
> 241 data[0] = TYPE_NO_LUN;
> 242
>
> If a initiator receives a response with TYPE_NO_LUN, does it care
> about all the rest? My tests with scsi_id does not stopped or treated
> TYPE_NO_LUN.
> Would it be simplier to test it in the beginning of this method and
> avoids checks along it?
No. If no LU is attached to the specified LUN the standard inquiry data
should be returned. Arguably you could test for the presence of a LU
before assembling the vital product data though since we don't support
any target port identifiers. Please have a look at SPC-2.
> Does page 0x80 or 0x83 apply to a target without luns?
See above.
> Or even before, does build_inquiry_response should be called without a
> lun for the cmnd?
Definitely, even if it's just to convey to the initiator that no LU is
attached. Again, SPC-2 has all the dire details.
Btw., I haven't found the time to look at your patches, I hope to find
some spare time for a review soon. Possibly someone else wants to give a
review as well/instead to speed things up?
Cheers,
Arne
|