diff options
author | David Milburn <dmilburn@redhat.com> | 2015-07-13 12:48:23 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2015-07-15 11:47:24 -0400 |
commit | af34d637637eabaf49406eb35c948cd51ba262a6 (patch) | |
tree | 4dcfd80cdc49c3aa9fc9510e3edd93b97265be2a | |
parent | cda57b1b05cf7b8b99ab4b732bea0b05b6c015cc (diff) |
libata: add ATA_HORKAGE_MAX_SEC_1024 to revert back to previous max_sectors limit
Since no longer limiting max_sectors to BLK_DEF_MAX_SECTORS (commit 34b48db66e08),
data corruption may occur on ST380013AS drive configured on 82801JI (ICH10 Family)
SATA controller. This patch will allow the driver to limit max_sectors as before
# cat /sys/block/sdb/queue/max_sectors_kb
512
I was able to double the max_sectors_kb value up to 16384 on linux-4.2.0-rc2
before seeing corruption, but seems safer to use previous limit. Without this
patch max_sectors_kb will be 32767.
tj: Minor comment update.
Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: David Milburn <dmilburn@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org # v3.19 and later
Fixes: 34b48db66e08 ("block: remove artifical max_hw_sectors cap")
-rw-r--r-- | drivers/ata/libata-core.c | 10 | ||||
-rw-r--r-- | include/linux/ata.h | 1 | ||||
-rw-r--r-- | include/linux/libata.h | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index ed2b218ea64d..68202a8a3a0b 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2478,6 +2478,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
2478 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2478 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
2479 | dev->max_sectors); | 2479 | dev->max_sectors); |
2480 | 2480 | ||
2481 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_1024) | ||
2482 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024, | ||
2483 | dev->max_sectors); | ||
2484 | |||
2481 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) | 2485 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) |
2482 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; | 2486 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; |
2483 | 2487 | ||
@@ -4146,6 +4150,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4146 | { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | 4150 | { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
4147 | { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | 4151 | { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
4148 | 4152 | ||
4153 | /* | ||
4154 | * Causes silent data corruption with higher max sects. | ||
4155 | * http://lkml.kernel.org/g/x49wpy40ysk.fsf@segfault.boston.devel.redhat.com | ||
4156 | */ | ||
4157 | { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, | ||
4158 | |||
4149 | /* Devices we expect to fail diagnostics */ | 4159 | /* Devices we expect to fail diagnostics */ |
4150 | 4160 | ||
4151 | /* Devices where NCQ should be avoided */ | 4161 | /* Devices where NCQ should be avoided */ |
diff --git a/include/linux/ata.h b/include/linux/ata.h index fed36418dd1c..6c78956aa470 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -45,6 +45,7 @@ enum { | |||
45 | ATA_SECT_SIZE = 512, | 45 | ATA_SECT_SIZE = 512, |
46 | ATA_MAX_SECTORS_128 = 128, | 46 | ATA_MAX_SECTORS_128 = 128, |
47 | ATA_MAX_SECTORS = 256, | 47 | ATA_MAX_SECTORS = 256, |
48 | ATA_MAX_SECTORS_1024 = 1024, | ||
48 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ | 49 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ |
49 | ATA_MAX_SECTORS_TAPE = 65535, | 50 | ATA_MAX_SECTORS_TAPE = 65535, |
50 | 51 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 5c8bac6225a6..c9cfbcdb8d14 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -432,7 +432,7 @@ enum { | |||
432 | ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ | 432 | ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ |
433 | ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ | 433 | ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ |
434 | ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ | 434 | ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ |
435 | 435 | ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ | |
436 | 436 | ||
437 | /* DMA mask for user DMA control: User visible values; DO NOT | 437 | /* DMA mask for user DMA control: User visible values; DO NOT |
438 | renumber */ | 438 | renumber */ |