From: Tejun Heo <htejun@gmail.com>
To: Christof Warlich <christof@warlich.name>
Cc: Robert Hancock <hancockrwd@gmail.com>,
linux-kernel@vger.kernel.org, ide <linux-ide@vger.kernel.org>
Subject: Re: "EXT3-fs error" after resume from s2ram
Date: Thu, 09 Jul 2009 00:21:47 +0900 [thread overview]
Message-ID: <4A54B98B.50806@gmail.com> (raw)
In-Reply-To: <4A54AD1A.1040009@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
Tejun Heo wrote:
> One thing we can do is to make libata remember the native size on
> initial probing and let revalidation consider it. Yeap, that would
> work. Can you please test the attached patch and post full log
> including boot and suspend/resume?
Patch slightly updated. Please test this one.
--
tejun
[-- Attachment #2: revalidate-consider-native.patch --]
[-- Type: text/x-patch, Size: 2342 bytes --]
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 045a486..111c5c9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1515,6 +1515,7 @@ static int ata_hpa_resize(struct ata_device *dev)
return rc;
}
+ dev->n_native_sectors = native_sectors;
/* nothing to do? */
if (native_sectors <= sectors || !ata_ignore_hpa) {
@@ -4089,6 +4090,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
unsigned int readid_flags)
{
u64 n_sectors = dev->n_sectors;
+ u64 n_native_sectors = dev->n_native_sectors;
int rc;
if (!ata_dev_enabled(dev))
@@ -4118,16 +4120,31 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
/* verify n_sectors hasn't changed */
if (dev->class == ATA_DEV_ATA && n_sectors &&
dev->n_sectors != n_sectors) {
- ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
+ ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch "
"%llu != %llu\n",
(unsigned long long)n_sectors,
(unsigned long long)dev->n_sectors);
- /* restore original n_sectors */
- dev->n_sectors = n_sectors;
-
- rc = -ENODEV;
- goto fail;
+ /*
+ * Something could have caused HPA to be unlocked
+ * involuntarily. If n_native_sectors hasn't changed
+ * and the new size matches it, keep the device.
+ */
+ if (dev->n_native_sectors == n_native_sectors &&
+ dev->n_sectors > n_sectors &&
+ dev->n_sectors == n_native_sectors) {
+ ata_dev_printk(dev, KERN_WARNING,
+ "new n_sectors matches native, probably "
+ "late HPA unlock, continuing\n");
+ dev->n_native_sectors = n_native_sectors;
+ dev->n_sectors = n_sectors;
+ } else {
+ /* restore original n_[native]_sectors */
+ dev->n_native_sectors = n_native_sectors;
+ dev->n_sectors = n_sectors;
+ rc = -ENODEV;
+ goto fail;
+ }
}
return 0;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3d501db..5fde0a9 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -588,6 +588,7 @@ struct ata_device {
#endif
/* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
u64 n_sectors; /* size of device, if ATA */
+ u64 n_native_sectors; /* native size, if ATA */
unsigned int class; /* ATA_DEV_xxx */
unsigned long unpark_deadline;
next prev parent reply other threads:[~2009-07-08 15:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4A4771FD.1020207@warlich.name>
[not found] ` <4A480859.5010206@gmail.com>
[not found] ` <4A48C799.2010102@warlich.name>
[not found] ` <4A495C2D.1040706@gmail.com>
[not found] ` <4A49A49C.10104@warlich.name>
[not found] ` <4A4C42E2.6030305@gmail.com>
[not found] ` <4A51C929.5010909@warlich.name>
2009-07-07 0:13 ` "EXT3-fs error" after resume from s2ram Robert Hancock
2009-07-07 7:04 ` Christof Warlich
2009-07-07 9:13 ` Christof Warlich
2009-07-07 14:19 ` Robert Hancock
2009-07-07 17:42 ` Christof Warlich
2009-07-07 23:30 ` Robert Hancock
2009-07-08 6:41 ` Christof Warlich
2009-07-08 14:28 ` Tejun Heo
2009-07-08 15:21 ` Tejun Heo [this message]
2009-07-09 18:17 ` Christof Warlich
2009-07-09 23:31 ` Robert Hancock
2009-07-10 13:21 ` Tejun Heo
2009-07-08 15:50 ` Christof Warlich
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=4A54B98B.50806@gmail.com \
--to=htejun@gmail.com \
--cc=christof@warlich.name \
--cc=hancockrwd@gmail.com \
--cc=linux-ide@vger.kernel.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).