From: Ben Hutchings <ben@decadent.org.uk>
To: linux-ide@vger.kernel.org
Cc: debian-kernel@lists.debian.org
Subject: Working around bogus HPAs in libata
Date: Sun, 21 Mar 2010 17:25:18 +0000 [thread overview]
Message-ID: <1269192318.18314.218.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]
Since SCSI has no concept of the Host Protected Area (HPA) supported by
ATA, ATA disks handled by libata have no set_capacity() operation and it
appears to be impossible to override an HPA except through the libata
module parameter.
In particular, this means that the workaround for bogus HPAs in
rescan_partitions() does not work:
if (bdops->set_capacity &&
(disk->flags & GENHD_FL_NATIVE_CAPACITY) == 0) {
printk(KERN_CONT "enabling native capacity\n");
capacity = bdops->set_capacity(disk, ~0ULL);
disk->flags |= GENHD_FL_NATIVE_CAPACITY;
if (capacity > get_capacity(disk)) {
set_capacity(disk, capacity);
check_disk_size_change(disk, bdev);
bdev->bd_invalidated = 0;
}
...
This creates a serious problem when transitioning from IDE drivers to
libata-based drivers: partitions may disappear or be truncated. For
example, see <http://bugs.debian.org/574795>.
One workaround is to ignore the HPA by default, but this can result in
data loss:
<https://bugs.launchpad.net/ubuntu/+source/linux/+bug/380138>.
I think that sd should implement set_capacity() and somehow pass through
requests to libata. This could perhaps be done using the new ATA
PASS-THROUGH commands in the SATL, but I regret that I do not know
enough about either ATA or SCSI to produce a patch.
Ben.
--
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2010-03-21 17:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-21 17:25 Ben Hutchings [this message]
2010-04-02 3:24 ` Working around bogus HPAs in libata Tejun Heo
2010-04-02 21:57 ` Ben Hutchings
2010-04-06 2:01 ` Tejun Heo
2010-04-06 2:28 ` Ben Hutchings
2010-04-06 2:33 ` Tejun Heo
2010-04-24 2:26 ` Ben Hutchings
2010-04-24 5:35 ` Tejun Heo
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=1269192318.18314.218.camel@localhost \
--to=ben@decadent.org.uk \
--cc=debian-kernel@lists.debian.org \
--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