linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-ide@vger.kernel.org
Subject: Re: Comments - using the qc_defer hook for serializing controllers ?
Date: Mon, 10 Dec 2007 17:46:01 +0900	[thread overview]
Message-ID: <475CFCC9.8000408@gmail.com> (raw)
In-Reply-To: <20071205152658.563466b7@the-village.bc.nu>

Alan Cox wrote:
> +/**
> + *	sl82c105_qc_defer	-	implement serialization
> + *	@qc: command
> + *
> + *	We must issue one command per host not per channel because
> + *	of the reset bug.
> + *
> + *	Q: is the scsi host lock sufficient ?
> + */
> +
> +static int sl82c105_qc_defer(struct ata_queued_cmd *qc)
> +{
> +	struct ata_host *host = qc->ap->host;
> +	int rc;
> +
> +	/* First apply the usual rules */	
> +	rc = ata_std_qc_defer(qc);
> +	if (rc != 0)
> +		return rc;
> +
> +	/* Now apply serialization rules. Only allow a command if the
> +	   other channel state machine is idle */
> +	if (host->port[0] != qc->ap && 
> +			host->port[0]->hsm_task_state != HSM_ST_IDLE)
> +		return	ATA_DEFER_PORT;
> +	if (host->port[1] != qc->ap && 
> +			host->port[1]->hsm_task_state != HSM_ST_IDLE)
> +		return	ATA_DEFER_PORT;
> +	return 0;
> +}

hsm_task_state is not necessarily protected by host lock.  I think
testing ap->qc_active would be better.

-- 
tejun

      reply	other threads:[~2007-12-10  8:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-05 15:26 Comments - using the qc_defer hook for serializing controllers ? Alan Cox
2007-12-10  8:46 ` Tejun Heo [this message]

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=475CFCC9.8000408@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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).