mvsas: ATAPI lun issue
PATCH RESEND 9/9 mvsas: ATAPI lun issue
I found that sending REPORT_LUNS command to some DVD device will cause fis error and controller error record. As a result, scsi mid layer get some wrong LUNs. Also I can get some queer messages.
scsi: host 12 channel 0 id 2 lun 0x30302e302f686f73 has a LUN larger than currently supported.
scsi: host 12 channel 0 id 2 lun 0x7431322f706f7274 has a LUN larger than currently supported.
scsi: host 12 channel 0 id 2 lun 0x2d31323a322f656e has a LUN larger than currently supported.
...
The patch forced to clear the sg buffer of SATA response if FIS is error. But I suggest these codes should merge to the libsas module.
--- drivers/scsi/mvsas.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/scsi/mvsas.c +7 -1
@@ -1263,8 +1263,14 @@ static int mvs_sata_done(struct mvs_info *mvi, struct sas_task *task,SATA_RECEIVED_D2H_FIS (port->taskfileset), sizeof(struct dev_to_host_fis)); tstat->buf_valid_size =sizeof (*resp); -if (unlikely (err)) +if (unlikely (err)) { +struct scatterlist *sg = task->scatter; +u8 *buf; stat =SAS_PROTO_RESPONSE ; + buf =kmap_atomic (sg_page (sg),KM_IRQ0 ) + sg->offset; +memset (buf,0 , sg->length); +kunmap_atomic (buf - sg->offset,KM_IRQ0 ); + }return stat; }
Signature · 1 line
1.5.4
Quoted 25 lines · Ke Wei
I found that sending
REPORT_LUNScommand to some DVD device will cause fis error and controller error record. As a result, scsi mid layer get some wrong LUNs. Also I can get some queer messages.scsi: host 12 channel 0 id 2 lun
0x30302e302f686f73has a LUN larger than currently supported.
scsi: host 12 channel 0 id 2 lun0x7431322f706f7274has a LUN larger than currently supported.
scsi: host 12 channel 0 id 2 lun0x2d31323a322f656ehas a LUN larger than currently supported.
...The patch forced to clear the sg buffer of SATA response if FIS is error. But I suggest these codes should merge to the libsas module.
Signed-off-by Ke Wei <[email protected]>--- drivers/scsi/mvsas.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)drivers/scsi/mvsas.c +0
-0@@ -1263,8 +1263,14 @@ static int mvs_sata_done(struct mvs_info *mvi, struct sas_task *task,SATA_RECEIVED_D2H_FIS (port->taskfileset), sizeof(struct dev_to_host_fis));
drivers/scsi/mvsas.c static int mvs_sata_done(struct mvs_info *mvi, struct sas_task *task, · line 1273
Quoted 10 lines
drivers/scsi/mvsas.c +7
-1tstat->buf_valid_size =sizeof (*resp); -if (unlikely (err)) +if (unlikely (err)) { +struct scatterlist *sg = task->scatter; +u8 *buf; stat =SAS_PROTO_RESPONSE ; + buf =kmap_atomic (sg_page (sg),KM_IRQ0 ) + sg->offset; +memset (buf,0 , sg->length); +kunmap_atomic (buf - sg->offset,KM_IRQ0 ); + }
double-check that this is inside spin_lock_irqsave()
if not, kmap_atomic()..kunmap_atomic() needs to be surrounded by local_irq_save() and local_irq_restore()
Jeff