RE: FCoE Target naming - help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unfortunately Nicholas still the same :(
Vendor ID	LIO-ORG_
Product ID	IBLOCK__________
Firmware Revision	4.0_
Hardware ID	LIO-ORG_IBLOCK__________-93b75951-cb09-49fb-8b6c-b3c52d7f-600140593b75951cb0949fb8b6cb3c52-00
Inquiry String	000005021fb00002LIO-ORG_IBLOCK__________4.0_

This is full info i see about the LUN. But _ still reamins after this patch too.

S pozdravom / Best regards
 
Tomas Molota
Chief Technology Officer


Parickova 18, 821 08 Bratislava, Slovakia
e-mail: tomas.molota@xxxxxxxxxxxxx
web: www.lightstorm.sk
phone: +421 2 32 400 011
cell phone: +421 903 788 100

-----Original Message-----
From: Nicholas A. Bellinger [mailto:nab@xxxxxxxxxxxxxxx] 
Sent: Friday, July 26, 2013 12:22 AM
To: Tomas Molota
Cc: 'Roland Dreier'; 'target-devel'
Subject: Re: FCoE Target naming - help

Hi Tomas,

On Thu, 2013-07-25 at 21:10 +0200, Tomas Molota wrote:
> Ok Nicholas i solved to problem with versions, i compiled with 3.9.8 and its work, but with patch is still the same:
> Hardware ID	LIO-ORG_IBLOCK__________-93b75951-cb09-49fb-8b6c-b3c52d7f-600140593b75951cb0949fb8b6cb3c52-00
> 

Apologies, my mistake.  The sizeof() usage in the original patch was still overwriting the '0x20' values with zeros for the INQUIRY MODEL field.

Please re-test with the following patch that keeps the extra ASCII space characters.

diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 4cb667d..9fabbf7 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -97,9 +97,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
 
        buf[7] = 0x2; /* CmdQue=1 */
 
-       snprintf(&buf[8], 8, "LIO-ORG");
-       snprintf(&buf[16], 16, "%s", dev->t10_wwn.model);
-       snprintf(&buf[32], 4, "%s", dev->t10_wwn.revision);
+       memcpy(&buf[8], "LIO-ORG ", 8);
+       memset(&buf[16], 0x20, 16);
+       memcpy(&buf[16], dev->t10_wwn.model,
+              min_t(size_t, strlen(dev->t10_wwn.model), 16));
+       memcpy(&buf[32], dev->t10_wwn.revision,
+              min_t(size_t, strlen(dev->t10_wwn.revision), 4));
        buf[4] = 31; /* Set additional length to 31 */
 
        return 0;

Also, you can verify with sg_inq to make sure the '0x20' values appear at the end of MODEL, eg:

# sg_inq -H /dev/sdb
standard INQUIRY:
 00     00 00 05 02 1f b0 00 02  4c 49 4f 2d 4f 52 47 20    ........LIO-ORG 
 10     52 41 4d 44 49 53 4b 2d  4d 43 50 20 20 20 20 20    RAMDISK-MCP     

Thanks!

--nab

> S pozdravom / Best regards
>  
> Tomas Molota
> Chief Technology Officer
> 
> 
> Parickova 18, 821 08 Bratislava, Slovakia
> e-mail: tomas.molota@xxxxxxxxxxxxx
> web: www.lightstorm.sk
> phone: +421 2 32 400 011
> cell phone: +421 903 788 100
> 
> -----Original Message-----
> From: Nicholas A. Bellinger [mailto:nab@xxxxxxxxxxxxxxx]
> Sent: Thursday, July 25, 2013 1:14 AM
> To: Roland Dreier
> Cc: Tomas Molota; target-devel
> Subject: Re: FCoE Target naming - help
> 
> On Wed, 2013-07-24 at 09:36 -0700, Roland Dreier wrote:
> > On Wed, Jul 24, 2013 at 8:11 AM, Tomas Molota 
> > <tomas.molota@xxxxxxxxxxxxx> wrote:
> > > Hello, iam trying to use LIO as FCoE ALUA target and i have 
> > > problem with naming which LIO shows to initiators. What i see:
> > > Vendor ID : LIO-ORG_
> > > Product ID: IBLOCK__________
> > > And our system has problem with "_" which are not allowed as name 
> > > of storage and its shows me error with this LUN as not supported 
> > > device. Is it possible somehow to change this option?
> > 
> > Do you mean spaces where you write "_"?  What do mean by "show to 
> > initiators"?  If you mean the data in the INQUIRY response, then 
> > that's what the SCSI spec mandates.  In SPC-4, for example, the 
> > vendor field is specified as:
> > 
> > "The T10 VENDOR IDENTIFICATION field contains eight bytes of 
> > left-aligned ASCII data (see 4.3.1) identifying the vendor of the 
> > logical unit."
> > 
> > where 4.3.1 says:
> > 
> > "ASCII data fields described as being left-aligned shall have any 
> > unused bytes at the end of the field (i.e., highest offset) and the 
> > unused bytes shall be filled with ASCII space characters (20h)."
> > 
> > Similarly for the product id fields.
> > 
> > so according to the SCSI standards, padding those fields with spaces 
> > is required.
> > 
> 
> Mmmm, then this is a bug in spc_emulate_inquiry_std() for VENDOR + MODEL fields.
> 
> Thomas, can you please verify with the following patch..?
> 
> --nab
> 
> diff --git a/drivers/target/target_core_spc.c 
> b/drivers/target/target_core_spc.c
> index 4cb667d..a4a29c6 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -97,9 +97,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, 
> unsigned char *buf)
>  
>         buf[7] = 0x2; /* CmdQue=1 */
>  
> -       snprintf(&buf[8], 8, "LIO-ORG");
> -       snprintf(&buf[16], 16, "%s", dev->t10_wwn.model);
> -       snprintf(&buf[32], 4, "%s", dev->t10_wwn.revision);
> +       memcpy(&buf[8], "LIO-ORG ", 8);
> +       memset(&buf[16], 0x20, 16);
> +       memcpy(&buf[16], dev->t10_wwn.model,
> +              min_t(size_t, sizeof(dev->t10_wwn.model), 16));
> +       memcpy(&buf[32], dev->t10_wwn.revision,
> +              min_t(size_t, sizeof(dev->t10_wwn.revision), 4));
>         buf[4] = 31; /* Set additional length to 31 */
>  
>         return 0;
> 
> 
> --
> 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



--
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




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux