libata and bogus LBA48 drives
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 29 Oct 2007 20:21:37 +0000 (21:21 +0100)
committerJeff Garzik <jeff@garzik.org>
Mon, 5 Nov 2007 03:53:15 +0000 (22:53 -0500)
A colleague noticed recent versions of Ubuntu no longer detect his 80 GB
ST380020ACE drive. This drive is special in that it advertises LBA48 support,
but has the lba_capacity_2 field set to zero (cfr.
http://lkml.org/lkml/2004/3/30/163).

Upon closer look, libata indeed doesn't seem to handle this case yet.
Below is an (untested) fix.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
include/linux/ata.h

index 61535e72834dcf79403a222c6875d95cafea619a..304825b1c977ddacf25c81588975a4ea46a490b2 100644 (file)
@@ -425,6 +425,8 @@ static inline int ata_id_has_lba48(const u16 *id)
 {
        if ((id[83] & 0xC000) != 0x4000)
                return 0;
+       if (!ata_id_u64(id, 100))
+               return 0;
        return id[83] & (1 << 10);
 }