From: Sergio Callegari <sergio.callegari@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>, linux-kernel@vger.kernel.org
Subject: Re: "scsi: convert host_busy to atomic_t" series causes regressions for some hardware configurations
Date: Wed, 26 Aug 2015 09:14:55 +0200 [thread overview]
Message-ID: <55DD676F.3060109@gmail.com> (raw)
In-Reply-To: <20150825110057.GA30711@infradead.org>
Sure, thanks!
I'll test this weekend.
Best,
Sergio
On 25/08/2015 13:00, Christoph Hellwig wrote:
> Hi Sergio,
>
> can you give the patch below a try?
>
> libata currently completes the SCSI command before freeing the internal
> command structure, which could lead to various races that mess with
> the ATA command state, which might cause issues like the one you see.
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 641a61a..92cc156 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -1772,6 +1772,15 @@ nothing_to_do:
> return 1;
> }
>
> +static void ata_qc_done(struct ata_queued_cmd *qc)
> +{
> + struct scsi_cmnd *cmd = qc->scsicmd;
> + void (*done)(struct scsi_cmnd *) = qc->scsidone;
> +
> + ata_qc_free(qc);
> + done(cmd);
> +}
> +
> static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
> {
> struct ata_port *ap = qc->ap;
> @@ -1810,9 +1819,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
> if (need_sense && !ap->ops->error_handler)
> ata_dump_status(ap->print_id, &qc->result_tf);
>
> - qc->scsidone(cmd);
> -
> - ata_qc_free(qc);
> + ata_qc_done(qc);
> }
>
> /**
> @@ -2611,8 +2618,7 @@ static void atapi_sense_complete(struct ata_queued_cmd *qc)
> ata_gen_passthru_sense(qc);
> }
>
> - qc->scsidone(qc->scsicmd);
> - ata_qc_free(qc);
> + ata_qc_done(qc);
> }
>
> /* is it pointless to prefer PIO for "safety reasons"? */
> @@ -2707,8 +2713,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
> qc->dev->sdev->locked = 0;
>
> qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;
> - qc->scsidone(cmd);
> - ata_qc_free(qc);
> + ata_qc_done(qc);
> return;
> }
>
> @@ -2752,8 +2757,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
> cmd->result = SAM_STAT_GOOD;
> }
>
> - qc->scsidone(cmd);
> - ata_qc_free(qc);
> + ata_qc_done(qc);
> }
> /**
> * atapi_xlat - Initialize PACKET taskfile
next prev parent reply other threads:[~2015-08-26 7:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 20:58 IDE Floppy support for IOMEGA Zip Drive broken in 3.16 -> 3.17 transition Sergio Callegari
2015-06-25 21:31 ` Borislav Petkov
2015-08-18 7:44 ` Sergio Callegari
2015-08-20 8:08 ` Christoph Hellwig
2015-08-20 15:08 ` Sergio Callegari
2015-08-24 17:07 ` "scsi: convert host_busy to atomic_t" series causes regressions for some hardware configurations Sergio Callegari
2015-08-25 11:00 ` Christoph Hellwig
2015-08-26 7:14 ` Sergio Callegari [this message]
2015-08-30 10:54 ` Sergio Callegari
2015-09-07 7:31 ` Sergio Callegari
2015-09-07 17:51 ` Christoph Hellwig
2015-07-02 16:11 ` IDE Floppy support for IOMEGA Zip Drive broken in 3.16 -> 3.17 transition Ondrej Zary
2015-07-03 6:50 ` Sergio Callegari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55DD676F.3060109@gmail.com \
--to=sergio.callegari@gmail.com \
--cc=bp@alien8.de \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).