linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] -- Fix block layer hang on writing DVD
@ 2013-03-18  2:30 Shan Hai
  2013-03-18  2:30 ` [PATCH 1/2] libata: Use integer return value for atapi_command_packet_set Shan Hai
  2013-03-18  2:30 ` [PATCH 2/2] libata: Set max sector to 65535 for Slimtype DVD A DS8A8SH drive Shan Hai
  0 siblings, 2 replies; 4+ messages in thread
From: Shan Hai @ 2013-03-18  2:30 UTC (permalink / raw)
  To: jeff; +Cc: linux-ide


In this patch set:
Fix a bug which erroneously changed return type of a function in
include/linux/ata.h: 
Introduce a workaround for Slimtype DVD A  DS8A8SH drive lock up problem.

drivers/ata/libata-core.c |    4 ++++
 include/linux/ata.h       |    2 +-
 include/linux/libata.h    |    1 +
 3 files changed, 6 insertions(+), 1 deletions(-)

Thanks
Shan Hai


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

* [PATCH 1/2] libata: Use integer return value for atapi_command_packet_set
  2013-03-18  2:30 [PATCH 0/2] -- Fix block layer hang on writing DVD Shan Hai
@ 2013-03-18  2:30 ` Shan Hai
  2013-04-03 23:35   ` Jeff Garzik
  2013-03-18  2:30 ` [PATCH 2/2] libata: Set max sector to 65535 for Slimtype DVD A DS8A8SH drive Shan Hai
  1 sibling, 1 reply; 4+ messages in thread
From: Shan Hai @ 2013-03-18  2:30 UTC (permalink / raw)
  To: jeff; +Cc: linux-ide

The function returns type of ATAPI drives so it should return integer value.
The commit 4dce8ba94c7 (libata: Use 'bool' return value for ata_id_XXX) since
v2.6.39 changed the type of return value from int to bool, the change would
cause all of the ATAPI class drives to be treated as TYPE_TAPE and the
max_sectors of the drives to be set to 65535 because of the commit
f8d8e5799b7(libata: increase 128 KB / cmd limit for ATAPI tape drives), for the
function would return true for all ATAPI class drives and the TYPE_TAPE is
defined as 0x01.

Cc: stable@vger.kernel.org
Signed-off-by: Shan Hai <shan.hai@windriver.com>
---
 include/linux/ata.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/ata.h b/include/linux/ata.h
index 8f7a3d6..ee0bd95 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -954,7 +954,7 @@ static inline int atapi_cdb_len(const u16 *dev_id)
 	}
 }
 
-static inline bool atapi_command_packet_set(const u16 *dev_id)
+static inline int atapi_command_packet_set(const u16 *dev_id)
 {
 	return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f;
 }
-- 
1.7.0.5


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

* [PATCH 2/2] libata: Set max sector to 65535 for Slimtype DVD A  DS8A8SH drive
  2013-03-18  2:30 [PATCH 0/2] -- Fix block layer hang on writing DVD Shan Hai
  2013-03-18  2:30 ` [PATCH 1/2] libata: Use integer return value for atapi_command_packet_set Shan Hai
@ 2013-03-18  2:30 ` Shan Hai
  1 sibling, 0 replies; 4+ messages in thread
From: Shan Hai @ 2013-03-18  2:30 UTC (permalink / raw)
  To: jeff; +Cc: linux-ide

The Slimtype DVD A  DS8A8SH drive locks up when max sector is smaller than
65535, and the blow backtrace is observed on locking up:

INFO: task flush-8:32:1130 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
flush-8:32      D ffffffff8180cf60     0  1130      2 0x00000000
 ffff880273aef618 0000000000000046 0000000000000005 ffff880273aee000
 ffff880273aee000 ffff880273aeffd8 ffff880273aee010 ffff880273aee000
 ffff880273aeffd8 ffff880273aee000 ffff88026e842ea0 ffff880274a10000
Call Trace:
 [<ffffffff8168fc2d>] schedule+0x5d/0x70
 [<ffffffff8168fccc>] io_schedule+0x8c/0xd0
 [<ffffffff81324461>] get_request+0x731/0x7d0
 [<ffffffff8133dc60>] ? cfq_allow_merge+0x50/0x90
 [<ffffffff81083aa0>] ? wake_up_bit+0x40/0x40
 [<ffffffff81320443>] ? bio_attempt_back_merge+0x33/0x110
 [<ffffffff813248ea>] blk_queue_bio+0x23a/0x3f0
 [<ffffffff81322176>] generic_make_request+0xc6/0x120
 [<ffffffff81322308>] submit_bio+0x138/0x160
 [<ffffffff811d7596>] ? bio_alloc_bioset+0x96/0x120
 [<ffffffff811d1f61>] submit_bh+0x1f1/0x220
 [<ffffffff811d48b8>] __block_write_full_page+0x228/0x340
 [<ffffffff811d3650>] ? attach_nobh_buffers+0xc0/0xc0
 [<ffffffff811d8960>] ? I_BDEV+0x10/0x10
 [<ffffffff811d8960>] ? I_BDEV+0x10/0x10
 [<ffffffff811d4ab6>] block_write_full_page_endio+0xe6/0x100
 [<ffffffff811d4ae5>] block_write_full_page+0x15/0x20
 [<ffffffff811d9268>] blkdev_writepage+0x18/0x20
 [<ffffffff81142527>] __writepage+0x17/0x40
 [<ffffffff811438ba>] write_cache_pages+0x34a/0x4a0
 [<ffffffff81142510>] ? set_page_dirty+0x70/0x70
 [<ffffffff81143a61>] generic_writepages+0x51/0x80
 [<ffffffff81143ab0>] do_writepages+0x20/0x50
 [<ffffffff811c9ed6>] __writeback_single_inode+0xa6/0x2b0
 [<ffffffff811ca861>] writeback_sb_inodes+0x311/0x4d0
 [<ffffffff811caaa6>] __writeback_inodes_wb+0x86/0xd0
 [<ffffffff811cad43>] wb_writeback+0x1a3/0x330
 [<ffffffff816916cf>] ? _raw_spin_lock_irqsave+0x3f/0x50
 [<ffffffff811b8362>] ? get_nr_inodes+0x52/0x70
 [<ffffffff811cb0ac>] wb_do_writeback+0x1dc/0x260
 [<ffffffff8168dd34>] ? schedule_timeout+0x204/0x240
 [<ffffffff811cb232>] bdi_writeback_thread+0x102/0x2b0
 [<ffffffff811cb130>] ? wb_do_writeback+0x260/0x260
 [<ffffffff81083550>] kthread+0xc0/0xd0
 [<ffffffff81083490>] ? kthread_worker_fn+0x1b0/0x1b0
 [<ffffffff8169a3ec>] ret_from_fork+0x7c/0xb0
 [<ffffffff81083490>] ? kthread_worker_fn+0x1b0/0x1b0

 The above trace was triggered by
   "dd if=/dev/zero of=/dev/sr0 bs=2048 count=32768"

 It was previously working by accident, since another bug introduced
 by 4dce8ba94c7 (libata: Use 'bool' return value for ata_id_XXX) caused
 all drives to use maxsect=65535.

Cc: stable@vger.kernel.org
Signed-off-by: Shan Hai <shan.hai@windriver.com>
---
 drivers/ata/libata-core.c |    4 ++++
 include/linux/libata.h    |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 497adea..0075944 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2439,6 +2439,9 @@ int ata_dev_configure(struct ata_device *dev)
 		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
 					 dev->max_sectors);
 
+	if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48)
+		dev->max_sectors = ATA_MAX_SECTORS_LBA48;
+
 	if (ap->ops->dev_config)
 		ap->ops->dev_config(dev);
 
@@ -4100,6 +4103,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
 	/* Weird ATAPI devices */
 	{ "TORiSAN DVD-ROM DRD-N216", NULL,	ATA_HORKAGE_MAX_SEC_128 },
 	{ "QUANTUM DAT    DAT72-000", NULL,	ATA_HORKAGE_ATAPI_MOD16_DMA },
+	{ "Slimtype DVD A  DS8A8SH", NULL,	ATA_HORKAGE_MAX_SEC_LBA48 },
 
 	/* Devices we expect to fail diagnostics */
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 91c9d10..eae7a05 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -398,6 +398,7 @@ enum {
 	ATA_HORKAGE_NOSETXFER	= (1 << 14),	/* skip SETXFER, SATA only */
 	ATA_HORKAGE_BROKEN_FPDMA_AA	= (1 << 15),	/* skip AA */
 	ATA_HORKAGE_DUMP_ID	= (1 << 16),	/* dump IDENTIFY data */
+	ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
 
 	 /* DMA mask for user DMA control: User visible values; DO NOT
 	    renumber */
-- 
1.7.0.5


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

* Re: [PATCH 1/2] libata: Use integer return value for atapi_command_packet_set
  2013-03-18  2:30 ` [PATCH 1/2] libata: Use integer return value for atapi_command_packet_set Shan Hai
@ 2013-04-03 23:35   ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2013-04-03 23:35 UTC (permalink / raw)
  To: Shan Hai; +Cc: jeff, linux-ide

On 03/17/2013 10:30 PM, Shan Hai wrote:
> The function returns type of ATAPI drives so it should return integer value.
> The commit 4dce8ba94c7 (libata: Use 'bool' return value for ata_id_XXX) since
> v2.6.39 changed the type of return value from int to bool, the change would
> cause all of the ATAPI class drives to be treated as TYPE_TAPE and the
> max_sectors of the drives to be set to 65535 because of the commit
> f8d8e5799b7(libata: increase 128 KB / cmd limit for ATAPI tape drives), for the
> function would return true for all ATAPI class drives and the TYPE_TAPE is
> defined as 0x01.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Shan Hai <shan.hai@windriver.com>
> ---
>   include/linux/ata.h |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)

applied 1-2




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

end of thread, other threads:[~2013-04-03 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-18  2:30 [PATCH 0/2] -- Fix block layer hang on writing DVD Shan Hai
2013-03-18  2:30 ` [PATCH 1/2] libata: Use integer return value for atapi_command_packet_set Shan Hai
2013-04-03 23:35   ` Jeff Garzik
2013-03-18  2:30 ` [PATCH 2/2] libata: Set max sector to 65535 for Slimtype DVD A DS8A8SH drive Shan Hai

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