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:
signature.asc
Description: This is a digitally signed message part