linux/block
Tim Wright ad337591f4 [SCSI] block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler.
It seems cdrwtool in the udftools has been unusable on "modern" kernels
for some time. A Google search reveals many people with the same issue
but no solution (cdrwtool fails to format the disk). After spending some
time tracking down the issue, it comes down to the following:

The udftools still use the older CDROM_SEND_PACKET interface to send
things like FORMAT_UNIT through to the drive. They should really be
updated, but that's another story. Since most distros are using libata
now, the cd or dvd burner appears as a SCSI device, and we wind up in
block/scsi_ioctl.c. Here, the code tries to take the "struct
cdrom_generic_command" and translate it and stuff it into a "struct
sg_io_hdr" structure so it can pass it to the modern sg_io() routine
instead. Unfortunately, there is one error, or rather an omission in the
translation. The timeout that is passed in in the "struct
cdrom_generic_command" is in HZ=100 units, and this is modified and
correctly converted to jiffies by use of clock_t_to_jiffies(). However,
a little further down, this cgc.timeout value in jiffies is simply
copied into the sg_io_hdr timeout, which should be in milliseconds.
Since most modern x86 kernels seems to be getting build with HZ=250, the
timeout that is passed to sg_io and eventually converted to the
timeout_per_command member of the scsi_cmnd structure is now four times
too small. Since cdrwtool tries to set the timeout to one hour for the
FORMAT_UNIT command, and it takes about 20 minutes to format a 4x CDRW,
the SCSI error-handler kicks in after the FORMAT_UNIT completes because
it took longer than the incorrectly-calculated timeout.

[jejb: fix up whitespace]
Signed-off-by: Tim Wright <timw@splhi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-07-30 10:18:29 -05:00
..
as-iosched.c Use WARN() in block/ 2008-07-26 12:00:07 -07:00
blk-barrier.c block: remove remaining __FUNCTION__ occurrences 2008-05-01 08:04:02 -07:00
blk-core.c block: remove the checking for NULL queue in blk_put_request 2008-07-15 21:21:45 +02:00
blk-exec.c block: unexport blk_end_sync_rq 2008-07-15 21:21:45 +02:00
blk-integrity.c block: integrity flags can't use bit ops on unsigned short 2008-07-03 13:21:15 +02:00
blk-ioc.c cfq-iosched: fix RCU race in the cfq io_context destructor handling 2008-05-07 09:28:57 +02:00
blk-map.c block/blk-map.c: use the new object_is_on_stack() helper 2008-07-26 12:00:02 -07:00
blk-merge.c block: Block layer data integrity support 2008-07-03 13:21:13 +02:00
blk-settings.c block: add blk_queue_update_dma_pad 2008-07-04 09:52:13 +02:00
blk-sysfs.c block: sysfs store function needs to grab queue_lock and use queue_flag_*() 2008-05-07 09:09:39 +02:00
blk-tag.c block: adjust tagging function queue bit locking 2008-05-07 09:27:43 +02:00
blk.h block: Block layer data integrity support 2008-07-03 13:21:13 +02:00
blktrace.c Added in user-injected messages into blk traces 2008-07-03 13:21:12 +02:00
bsg.c device create: block: convert device_create to device_create_drvdata 2008-07-21 21:54:41 -07:00
cfq-iosched.c cfq-iosched: get rid of enable_idle being unused warning 2008-07-03 13:21:14 +02:00
cmd-filter.c cmdfilter: extend default read filter 2008-07-03 13:21:14 +02:00
compat_ioctl.c Fix misuses of bdevname() 2008-05-13 08:02:26 -07:00
deadline-iosched.c block: let elv_register() return void 2007-12-18 08:29:28 +01:00
elevator.c block: request_module(): use format string 2008-07-03 13:21:15 +02:00
genhd.c block: make /proc/partitions and /proc/diskstats use class_find_device() 2008-07-21 21:54:49 -07:00
ioctl.c block/ioctl.c and fs/partition/check.c: check value returned by add_partition() 2008-07-25 10:53:44 -07:00
Kconfig block: Block layer data integrity support 2008-07-03 13:21:13 +02:00
Kconfig.iosched update I/O sched Kconfig help texts - CFQ is now default, not AS. 2007-02-17 20:08:22 +01:00
Makefile allow userspace to modify scsi command filter on per device basis 2008-07-03 13:21:14 +02:00
noop-iosched.c block: let elv_register() return void 2007-12-18 08:29:28 +01:00
scsi_ioctl.c [SCSI] block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler. 2008-07-30 10:18:29 -05:00