Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1448063 > unrolled thread

[PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page

Started bytom.ty89@gmail.com
First post2016-07-21 20:50 +0200
Last post2016-07-25 20:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page tom.ty89@gmail.com - 2016-07-21 20:50 +0200
    Re: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for  Control mode page Tejun Heo <tj@kernel.org> - 2016-07-21 23:30 +0200
      Re: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for  Control mode page Tom Yan <tom.ty89@gmail.com> - 2016-07-22 00:00 +0200
        Re: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for  Control mode page Tejun Heo <tj@kernel.org> - 2016-07-25 20:40 +0200

#1448063 — [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page

Fromtom.ty89@gmail.com
Date2016-07-21 20:50 +0200
Subject[PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page
Message-ID<rXrcJ-2T6-5@gated-at.bofh.it>
From: Tom Yan <tom.ty89@gmail.com>

scsi_done() was called repeatedly and apparently because of that,
the kernel would call trace when we touch the Control mode page:

Call Trace:
 [<ffffffff812ea0d2>] dump_stack+0x63/0x81
 [<ffffffff81079cfb>] __warn+0xcb/0xf0
 [<ffffffff81079e2d>] warn_slowpath_null+0x1d/0x20
 [<ffffffffa00f51b0>] ata_eh_finish+0xe0/0xf0 [libata]
 [<ffffffffa00fb830>] sata_pmp_error_handler+0x640/0xa50 [libata]
 [<ffffffffa00470ed>] ahci_error_handler+0x1d/0x70 [libahci]
 [<ffffffffa00f55f0>] ata_scsi_port_error_handler+0x430/0x770 [libata]
 [<ffffffffa00eff8d>] ? ata_scsi_cmd_error_handler+0xdd/0x160 [libata]
 [<ffffffffa00f59d7>] ata_scsi_error+0xa7/0xf0 [libata]
 [<ffffffffa00913ba>] scsi_error_handler+0xaa/0x560 [scsi_mod]
 [<ffffffffa0091310>] ? scsi_eh_get_sense+0x180/0x180 [scsi_mod]
 [<ffffffff81098eb8>] kthread+0xd8/0xf0
 [<ffffffff815d913f>] ret_from_fork+0x1f/0x40
 [<ffffffff81098de0>] ? kthread_worker_fn+0x170/0x170
---[ end trace 8b7501047e928a17 ]---

Removed the unnecessary code and let ata_scsi_translate() do the job.

Also, since ata_mselect_control() has no ATA command to send to the
device, ata_scsi_mode_select_xlat() should return 1 for it, so that
ata_scsi_translate() will finish early to avoid ata_qc_issue().

Signed-off-by: Tom Yan <tom.ty89@gmail.com>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 6c424c5..f5c4200 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3720,8 +3720,6 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
 		dev->flags |= ATA_DFLAG_D_SENSE;
 	else
 		dev->flags &= ~ATA_DFLAG_D_SENSE;
-	qc->scsicmd->result = SAM_STAT_GOOD;
-	qc->scsicmd->scsi_done(qc->scsicmd);
 	return 0;
 }
 
@@ -3854,6 +3852,8 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
 		if (ata_mselect_control(qc, p, pg_len, &fp) < 0) {
 			fp += hdr_len + bd_len;
 			goto invalid_param;
+		} else {
+			goto skip; /* No ATA command to send */
 		}
 		break;
 	default:		/* invalid page code */
-- 
2.9.0

[toc] | [next] | [standalone]


#1448176 — Re: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page

FromTejun Heo <tj@kernel.org>
Date2016-07-21 23:30 +0200
SubjectRe: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page
Message-ID<rXtHA-4Eb-25@gated-at.bofh.it>
In reply to#1448063
On Fri, Jul 22, 2016 at 02:41:54AM +0800, tom.ty89@gmail.com wrote:
> @@ -3854,6 +3852,8 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
>  		if (ata_mselect_control(qc, p, pg_len, &fp) < 0) {
>  			fp += hdr_len + bd_len;
>  			goto invalid_param;
> +		} else {
> +			goto skip; /* No ATA command to send */

Hmmm... I'm a bit confused.  Why is mselect_control path different
from mselect_caching in terms of qc handling?

Thanks.

-- 
tejun

[toc] | [prev] | [next] | [standalone]


#1448203 — Re: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page

FromTom Yan <tom.ty89@gmail.com>
Date2016-07-22 00:00 +0200
SubjectRe: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page
Message-ID<rXuaC-4P9-7@gated-at.bofh.it>
In reply to#1448176
As I've mentioned in the comment/message, there is no ATA command
needed to be sent to the device, since it only toggles a bit in
dev->flags. See that there is no ata_taskfile constructed in
ata_mselect_control().

On 22 July 2016 at 05:26, Tejun Heo <tj@kernel.org> wrote:
> On Fri, Jul 22, 2016 at 02:41:54AM +0800, tom.ty89@gmail.com wrote:
>> @@ -3854,6 +3852,8 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
>>               if (ata_mselect_control(qc, p, pg_len, &fp) < 0) {
>>                       fp += hdr_len + bd_len;
>>                       goto invalid_param;
>> +             } else {
>> +                     goto skip; /* No ATA command to send */
>
> Hmmm... I'm a bit confused.  Why is mselect_control path different
> from mselect_caching in terms of qc handling?
>
> Thanks.
>
> --
> tejun

[toc] | [prev] | [next] | [standalone]


#1449731 — Re: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page

FromTejun Heo <tj@kernel.org>
Date2016-07-25 20:40 +0200
SubjectRe: [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page
Message-ID<rYSXg-7Yy-29@gated-at.bofh.it>
In reply to#1448203
On Fri, Jul 22, 2016 at 05:50:18AM +0800, Tom Yan wrote:
> As I've mentioned in the comment/message, there is no ATA command
> needed to be sent to the device, since it only toggles a bit in
> dev->flags. See that there is no ata_taskfile constructed in
> ata_mselect_control().

But ata_mselect_caching() contructs a tf?

-- 
tejun

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web