Skip to contentSkip to conversation

libata-scsi: do not respond with "invalid field" for FORMAT UNIT

PATCH In review [email protected] 3 participants 6 messages Jul 5, 2016 – Jul 6, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20160705064556.909-1-me

#1 lore raw

PATCH v2 2/2 libata-scsi: do not respond with "invalid field" for FORMAT UNIT

From: Tom Yan <[email protected]>

It does not make sense and is confusing to respond with "Invalid field in CDB" while we have no support at all implemented for FORMAT UNIT. It is decent to let it go to the default, which will respond with "Invalid command operation code" instead.

drivers/ata/libata-scsi.c +1 -6
index 029e738..ac5676e 100644
@@ -307,7 +307,7 @@ static void ata_scsi_set_invalid_field(struct ata_device *dev,
 				       struct scsi_cmnd *cmd, u16 field, u8 bit)
 {
 	ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
-	/* "Invalid field in cbd" */
+	/* "Invalid field in CDB" */
 	scsi_set_sense_field_pointer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
 				     field, bit, 1);
 }
@@ -4045,11 +4045,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
 	args.done = cmd->scsi_done;
 
 	switch(scsicmd[0]) {
-	/* TODO: worth improving? */
-	case FORMAT_UNIT:
-		ata_scsi_invalid_field(dev, cmd, 0);
-		break;
-
 	case INQUIRY:
 		if (scsicmd[1] & 2)		   /* is CmdDt set?  */
 		    ata_scsi_invalid_field(dev, cmd, 1);
Signature · 1 line
2.9.0
#2 lore raw
Quoted 14 lines · On 7/5/2016 9:45 AM, [email protected] wrote:

From: Tom Yan <[email protected]>

It does not make sense and is confusing to respond with "Invalid field in CDB" while we have no support at all implemented for FORMAT UNIT. It is decent to let it go to the default, which will respond with "Invalid command operation code" instead.

drivers/ata/libata-scsi.c +0 -0
index 029e738..ac5676e 100644

drivers/ata/libata-scsi.c static void ata_scsi_set_invalid_field(struct ata_device *dev, · line 310

Quoted 5 lines
drivers/ata/libata-scsi.c +1 -1
@@ -307,7 +307,7 @@ static void ata_scsi_set_invalid_field(struct ata_device *dev,
 				       struct scsi_cmnd *cmd, u16 field, u8 bit)
 {
 	ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
-	/* "Invalid field in cbd" */
+	/* "Invalid field in CDB" */

Don't do 2 things in one patch please> This change wasn't even documented
in the patch description.

[...]

MBR, Sergei

author
#3 lore raw

I just thought that such a minor change in a comment can fit in the same patch where the issue was first noticed. Anyway, will split them if I am going to send a v3 set.

Quoted 32 lines · Sergei Shtylyov
Quoted 14 lines · On 7/5/2016 9:45 AM, [email protected] wrote:

From: Tom Yan <[email protected]>

It does not make sense and is confusing to respond with "Invalid field in CDB" while we have no support at all implemented for FORMAT UNIT. It is decent to let it go to the default, which will respond with "Invalid command operation code" instead.

drivers/ata/libata-scsi.c +0 -0
index 029e738..ac5676e 100644

drivers/ata/libata-scsi.c static void ata_scsi_set_invalid_field(struct · line 312

Quoted 7 lines
drivers/ata/libata-scsi.c +1 -1
@@ -307,7 +307,7 @@ static void ata_scsi_set_invalid_field(struct
 ata_device *dev,
                                       struct scsi_cmnd *cmd, u16 field,
 u8 bit)
 {
        ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
-       /* "Invalid field in cbd" */
+       /* "Invalid field in CDB" */

Don't do 2 things in one patch please> This change wasn't even documented
in the patch description.

[...]

MBR, Sergei

#4 lore raw

Hello,

Quoted 4 lines · Tom Yan

I just thought that such a minor change in a comment can fit in the same patch where the issue was first noticed. Anyway, will split them if I am going to send a v3 set.

Quoted 29 lines
Quoted 27 lines · Sergei Shtylyov
Quoted 14 lines · On 7/5/2016 9:45 AM, [email protected] wrote:

From: Tom Yan <[email protected]>

It does not make sense and is confusing to respond with "Invalid field in CDB" while we have no support at all implemented for FORMAT UNIT. It is decent to let it go to the default, which will respond with "Invalid command operation code" instead.

drivers/ata/libata-scsi.c +0 -0
index 029e738..ac5676e 100644

drivers/ata/libata-scsi.c static void ata_scsi_set_invalid_field(struct · line 312

Quoted 7 lines
drivers/ata/libata-scsi.c +1 -1
@@ -307,7 +307,7 @@ static void ata_scsi_set_invalid_field(struct
 ata_device *dev,
                                       struct scsi_cmnd *cmd, u16 field,
 u8 bit)
 {
        ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
-       /* "Invalid field in cbd" */
+       /* "Invalid field in CDB" */

Don't do 2 things in one patch please> This change wasn't even documented
in the patch description.

So, for trivial cleanups, it's fine to do it along with other changes when the cleanups and the said changes are related and close by; however, the description should be able to encompass all changes. It doesn't have to be super detailed. Something like "While at it, do some trivial / typo / whatever cleanups" works fine.

Here, the cleanup isn't that close. I'd just drop that chunk. It really doesn't matter whether cdb is in caps or not.

Thanks.

Signature · 1 line
tejun
author
#5 lore raw

Um it's not mainly about in caps or not, but more about wrongly spelled as cbd.

Quoted 50 lines · Tejun Heo

Hello,

Quoted 4 lines · Tom Yan

I just thought that such a minor change in a comment can fit in the same patch where the issue was first noticed. Anyway, will split them if I am going to send a v3 set.

Quoted 29 lines
Quoted 27 lines · Sergei Shtylyov
Quoted 14 lines · On 7/5/2016 9:45 AM, [email protected] wrote:

From: Tom Yan <[email protected]>

It does not make sense and is confusing to respond with "Invalid field in CDB" while we have no support at all implemented for FORMAT UNIT. It is decent to let it go to the default, which will respond with "Invalid command operation code" instead.

drivers/ata/libata-scsi.c +0 -0
index 029e738..ac5676e 100644

drivers/ata/libata-scsi.c static void ata_scsi_set_invalid_field(struct · line 312

Quoted 7 lines
drivers/ata/libata-scsi.c +1 -1
@@ -307,7 +307,7 @@ static void ata_scsi_set_invalid_field(struct
 ata_device *dev,
                                       struct scsi_cmnd *cmd, u16 field,
 u8 bit)
 {
        ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
-       /* "Invalid field in cbd" */
+       /* "Invalid field in CDB" */

Don't do 2 things in one patch please> This change wasn't even documented
in the patch description.

So, for trivial cleanups, it's fine to do it along with other changes when the cleanups and the said changes are related and close by; however, the description should be able to encompass all changes. It doesn't have to be super detailed. Something like "While at it, do some trivial / typo / whatever cleanups" works fine.

Here, the cleanup isn't that close. I'd just drop that chunk. It really doesn't matter whether cdb is in caps or not.

Thanks.

--
tejun

#6 lore raw
Quoted 1 line · Tom Yan

Um it's not mainly about in caps or not, but more about wrongly spelled as cbd.

Heh, right, so please just note it in the description.

Thanks.

Signature · 1 line
tejun