linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elias Oltmanns <eo@nebensachen.de>
To: Tejun Heo <tj@kernel.org>
Cc: Jeff Garzik <jeff@garzik.org>, linux-ide@vger.kernel.org
Subject: Re: [PATCH 2/2 v3] libata: Implement disk shock protection support
Date: Sat, 20 Sep 2008 07:54:45 +0200	[thread overview]
Message-ID: <87abe37462.fsf@denkblock.local> (raw)
In-Reply-To: <48D4805A.3090707@kernel.org> (Tejun Heo's message of "Fri, 19 Sep 2008 21:47:22 -0700")

Tejun Heo <tj@kernel.org> wrote:
> Hello, Elias.
>
> Ah... we're so close but no ack yet.  Just a few nits.

A pity ;-) but you are quite right.

>
> It would be nice if there's explanation why action pulling is
> necessary in the first place.

Right.

>
>> +static inline void ata_eh_pull_park_action(struct ata_port *ap)
>> +{
>> +	struct ata_link *link;
>> +	struct ata_device *dev;
>> +	unsigned long flags;
>> +
>> +	/*
>> +	 * All write accesses to &ap->park_req_pending through
>> +	 * INIT_COMPLETION() (see below) or complete_all() (see
>> +	 * ata_scsi_park_store()) are protected by the host lock. As a
>> +	 * result we have that park_req_pending.done is zero on exit
>> +	 * from this function, i.e. when ATA_EH_PARK actions for *all*
>> +	 * devices on port ap have been pulled into the respective
>> +	 * eh_context structs. If, and only if, park_req_pending.done
>> +	 * is non-zero by the time we reach
>> +	 * wait_for_completion_timeout(), another ATA_EH_PARK action
>> +	 * has been scheduled for at least one of the devices on port
>> +	 * ap and we have to cycle over the do { } while () loop in
>> +	 * ata_eh_recover() again.
>> +	 */
> ...
>> +	do {
>> +		unsigned long now;
>> +
>> +		ata_eh_pull_park_action(ap);
>
> How about adding the folloiwng to the above line?
> 						/* clears park_req_pending */

Yes. I take it that this is in addition to some explanation within
ata_eh_pull_park_action() you have asked for above?

>
>> +static ssize_t ata_scsi_park_store(struct device *device,
>> +				   struct device_attribute *attr,
>> +				   const char *buf, size_t len)
>> +{
> ...
>> +		complete_all(&ap->park_req_pending);
>
> Sorry to catching this this late but calling complete_all() twice will
> overflow the done counter.  I think complete() should just work here,
> no?

Sorry for missing that in the first place, rather embarrassing that. I
had just assumed that the done counter was set to an absolute value
rather than added to. I really think that this is what we actually want,
so, perhaps, a seperate patch for Ingo or someone is in order?

The reason why I'd like to call complete_all() rather than complete() is
this: if two drives on seperate ports have been parked and userspace
updates the timeout for one of them, then complete() will only wake up
the thread that comes first in the wait queue park_req_pending.wait --
please note that complete() and complete_all() pass different arguments
to __wake_up_common(). 

Regards,

Elias

  reply	other threads:[~2008-09-20  5:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 21:41 Disk shock protection in libata Elias Oltmanns
2008-09-19 21:46 ` [PATCH 1/2 v3] Introduce ata_id_has_unload() Elias Oltmanns
2008-09-29  4:34   ` Jeff Garzik
2008-09-19 21:48 ` [PATCH 2/2 v3] libata: Implement disk shock protection support Elias Oltmanns
2008-09-20  4:47   ` Tejun Heo
2008-09-20  5:54     ` Elias Oltmanns [this message]
2008-09-20 11:12       ` Elias Oltmanns
2008-09-20 21:44         ` [PATCH 2/2 v4] " Elias Oltmanns
2008-09-20 23:55           ` Tejun Heo
2008-09-21  9:54             ` [PATCH 2/2 v5] " Elias Oltmanns
2008-09-21  9:58               ` Tejun Heo
2008-09-21  9:51       ` [PATCH 2/2 v3] " Elias Oltmanns

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=87abe37462.fsf@denkblock.local \
    --to=eo@nebensachen.de \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@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).