linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Working around bogus HPAs in libata
@ 2010-03-21 17:25 Ben Hutchings
  2010-04-02  3:24 ` Tejun Heo
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Hutchings @ 2010-03-21 17:25 UTC (permalink / raw)
  To: linux-ide; +Cc: debian-kernel

[-- 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 --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-04-24  5:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-21 17:25 Working around bogus HPAs in libata Ben Hutchings
2010-04-02  3:24 ` 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

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).