From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, linux-ide@vger.kernel.org, albertcc@tw.ibm.com
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 11/12] libata: ignore normal qc completion during EH
Date: Sun, 22 Jan 2006 16:58:31 +0900 [thread overview]
Message-ID: <11379167111733-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11379167103055-git-send-email-htejun@gmail.com>
Don't let interrupt handler and pio task complete qc's while EH is in
progress. This makes sure that qc's don't go away underneath EH.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/scsi/libata-core.c | 32 +++++++++++++++++++-------------
drivers/scsi/libata-scsi.c | 2 +-
drivers/scsi/libata.h | 1 +
3 files changed, 21 insertions(+), 14 deletions(-)
c72a043f83d46dd4b90a9f689beb5ed9b135fc3a
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index b2f51bb..9556100 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -3589,19 +3589,7 @@ void ata_qc_free(struct ata_queued_cmd *
}
}
-/**
- * ata_qc_complete - Complete an active ATA command
- * @qc: Command to complete
- * @err_mask: ATA Status register contents
- *
- * Indicate to the mid and upper layers that an ATA
- * command has completed, with either an ok or not-ok status.
- *
- * LOCKING:
- * spin_lock_irqsave(host_set lock)
- */
-
-void ata_qc_complete(struct ata_queued_cmd *qc)
+void __ata_qc_complete(struct ata_queued_cmd *qc)
{
assert(qc != NULL); /* ata_qc_from_tag _might_ return NULL */
assert(qc->flags & ATA_QCFLAG_ACTIVE);
@@ -3619,6 +3607,24 @@ void ata_qc_complete(struct ata_queued_c
qc->complete_fn(qc);
}
+/**
+ * ata_qc_complete - Complete an active ATA command
+ * @qc: Command to complete
+ * @err_mask: ATA Status register contents
+ *
+ * Indicate to the mid and upper layers that an ATA
+ * command has completed, with either an ok or not-ok status.
+ *
+ * LOCKING:
+ * spin_lock_irqsave(host_set lock)
+ */
+
+void ata_qc_complete(struct ata_queued_cmd *qc)
+{
+ if (!(qc->ap->flags & ATA_FLAG_IN_EH))
+ __ata_qc_complete(qc);
+}
+
static inline int ata_should_dma_map(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index cf54536..9e4bc3c 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -801,7 +801,7 @@ static void __ata_eh_qc_complete(struct
spin_lock_irqsave(&ap->host_set->lock, flags);
qc->scsidone = ata_eh_scsidone;
- ata_qc_complete(qc);
+ __ata_qc_complete(qc);
assert(!ata_tag_valid(qc->tag));
spin_unlock_irqrestore(&ap->host_set->lock, flags);
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 9d76923..1cd071a 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -46,6 +46,7 @@ extern struct ata_queued_cmd *ata_qc_new
extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc);
extern void ata_qc_free(struct ata_queued_cmd *qc);
extern unsigned int ata_qc_issue(struct ata_queued_cmd *qc);
+extern void __ata_qc_complete(struct ata_queued_cmd *qc);
extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
extern void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep);
--
1.0.8
next prev parent reply other threads:[~2006-01-22 7:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-22 7:58 [PATCHSET] libata: various fixes related to EH Tejun Heo
2006-01-22 7:58 ` [PATCH 02/12] libata: make the owner of a qc responsible for freeing it Tejun Heo
2006-01-22 9:37 ` Jeff Garzik
2006-01-22 10:16 ` Tejun Heo
2006-01-22 7:58 ` [PATCH 01/12] libata: fold __ata_qc_complete() into ata_qc_free() Tejun Heo
2006-01-22 7:58 ` [PATCH 03/12] libata: fix ata_qc_issue() error handling Tejun Heo
2006-01-22 9:25 ` Jeff Garzik
2006-01-22 7:58 ` [PATCH 06/12] SCSI: export scsi_eh_finish_cmd() and scsi_eh_flush_done_q() Tejun Heo
2006-01-22 9:36 ` Jeff Garzik
2006-01-22 7:58 ` [PATCH 05/12] libata: return AC_ERR_* from issue functions Tejun Heo
2006-01-22 9:36 ` Jeff Garzik
2006-01-22 7:58 ` [PATCH 04/12] libata: add detailed AC_ERR_* flags Tejun Heo
2006-01-22 9:30 ` Jeff Garzik
2006-01-22 9:46 ` Tejun Heo
2006-01-22 9:50 ` Tejun Heo
2006-01-22 7:58 ` [PATCH 07/12] libata: implement and apply ata_eh_qc_complete/retry() Tejun Heo
2006-01-22 7:58 ` [PATCH 09/12] libata: kill NULL qc handling from ->eng_timeout callbacks Tejun Heo
2006-01-22 7:58 ` [PATCH 08/12] libata: fix handling of race between timeout and completion Tejun Heo
2006-01-22 9:41 ` Jeff Garzik
2006-01-22 7:58 ` [PATCH 12/12] libata: EH / pio tasks synchronization Tejun Heo
2006-01-22 9:58 ` Jeff Garzik
2006-01-22 10:27 ` Tejun Heo
2006-01-22 7:58 ` [PATCH 10/12] libata: implement ATA_FLAG_IN_EH port flag Tejun Heo
2006-01-22 9:49 ` Jeff Garzik
2006-01-22 7:58 ` Tejun Heo [this message]
2006-01-22 9:53 ` [PATCH 11/12] libata: ignore normal qc completion during EH Jeff Garzik
2006-01-22 11:09 ` Tejun Heo
2006-01-22 9:10 ` [PATCHSET] libata: various fixes related to EH Jeff Garzik
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=11379167111733-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=albertcc@tw.ibm.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@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).