libata: fix last_reset timestamp handling
authorTejun Heo <tj@kernel.org>
Tue, 4 Nov 2008 08:08:40 +0000 (17:08 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 13 Nov 2008 17:56:04 +0000 (09:56 -0800)
commitd3f87e9d891c34cb073d7c08a9b014aa22e3b1cc
tree05f22f182f80ca31157ae3da89669c5c61cf425a
parent8d5dc6f7b2da3b6b108171b8051f18b6abc3ba1c
libata: fix last_reset timestamp handling

commit 19b723218bde79c60a394a3caee9eb156ac2d356 upstream

ehc->last_reset is used to ensure that resets are not issued too
close to each other.  It's initialized to jiffies minus one minute
on EH entry.  However, when new links are initialized after PMP is
probed, new links have zero for this timestamp resulting in long wait
depending on the current jiffies.

This patch makes last_set considered iff ATA_EHI_DID_RESET is set, in
which case last_reset is always initialized.  As an added precaution,
WARN_ON() is added so that warning is printed if last_reset is
in future.

This problem is spotted and debugged by Shane Huang.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Shane Huang <Shane.Huang@amd.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/ata/libata-eh.c