public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org, jejb@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
	Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Tim Wright <timw@splhi.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: [patch 04/60] SCSI: block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler.
Date: Mon, 18 Aug 2008 11:41:31 -0700	[thread overview]
Message-ID: <20080818184131.GE29394@suse.de> (raw)
In-Reply-To: <20080818184035.GA29394@suse.de>

[-- Attachment #1: scsi-block-fix-miscalculation-of-sg_io-timeout-in-cdrom_send_packet-handler.patch --]
[-- Type: text/plain, Size: 2500 bytes --]

2.6.26-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Tim Wright <timw@splhi.com>

commit ad337591f4fd20de6a0ca03d6715267a5c1d2b16 upstream

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>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 block/scsi_ioctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -629,7 +629,7 @@ int scsi_cmd_ioctl(struct file *file, st
 			hdr.sbp = cgc.sense;
 			if (hdr.sbp)
 				hdr.mx_sb_len = sizeof(struct request_sense);
-			hdr.timeout = cgc.timeout;
+			hdr.timeout = jiffies_to_msecs(cgc.timeout);
 			hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
 			hdr.cmd_len = sizeof(cgc.cmd);
 

-- 

  parent reply	other threads:[~2008-08-18 18:46 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080818191012.663450219@mini.kroah.org>
     [not found] ` <20080818183230.966310219@mini.kroah.org>
2008-08-18 18:40   ` [patch 00/60] 2.6.26-stable review Greg KH
2008-08-18 18:41     ` [patch 01/60] mlock() fix return values Greg KH
2008-08-18 18:41     ` [patch 02/60] SCSI: ses: fix VPD inquiry overrun Greg KH
2008-08-18 18:41     ` [patch 03/60] SCSI: scsi_transport_spi: fix oops in revalidate Greg KH
2008-08-18 18:41     ` Greg KH [this message]
2008-08-18 18:41     ` [patch 05/60] SCSI: hptiop: add more PCI device IDs Greg KH
2008-08-18 18:41     ` [patch 06/60] vt8623fb: fix kernel oops Greg KH
2008-08-18 18:41     ` [patch 07/60] relay: fix "full buffer with exactly full last subbuffer" accounting problem Greg KH
2008-08-18 18:41     ` [patch 08/60] ide-cd: fix endianity for the error message in cdrom_read_capacity Greg KH
2008-08-18 18:41     ` [patch 09/60] posix-timers: do_schedule_next_timer: fix the setting of ->si_overrun Greg KH
2008-08-18 18:41     ` [patch 10/60] posix-timers: fix posix_timer_event() vs dequeue_signal() race Greg KH
2008-08-18 18:42     ` [patch 11/60] radeonfb: fix accel engine hangs Greg KH
2008-08-18 18:42     ` [patch 12/60] matrox maven: fix a broken error path Greg KH
2008-08-18 18:42     ` [patch 13/60] USB: pl2023: Remove USB id (4348:5523) handled by ch341 Greg KH
2008-08-18 18:42     ` [patch 14/60] USB: fix interface unregistration logic Greg KH
2008-08-18 18:42     ` [patch 15/60] usb-storage: unusual_devs entries for iRiver T10 and Datafab CF+SM reader Greg KH
2008-08-18 18:43     ` [patch 16/60] USB: usb-storage: quirk around v1.11 firmware on Nikon D4 Greg KH
2008-08-18 18:43     ` [patch 17/60] usb-serial: dont release unregistered minors Greg KH
2008-08-18 18:43     ` [patch 18/60] USB: ftdi_sio: add support for Luminance Stellaris Evaluation/Development Kits Greg KH
2008-08-18 18:43     ` [patch 19/60] USB: ftdi_sio: Add USB Product Id for ELV HS485 Greg KH
2008-08-18 18:43     ` [patch 20/60] ipvs: Fix possible deadlock in estimator code Greg KH
2008-08-19  0:31       ` Simon Horman
2008-08-18 18:43     ` [patch 21/60] acer-wmi: Fix wireless and bluetooth on early AMW0 v2 laptops Greg KH
2008-08-18 18:43     ` [patch 22/60] CIFS: mount of IPC$ breaks with iget patch Greg KH
2008-08-18 18:43     ` [patch 23/60] CIFS: if get root inode fails during mount, cleanup tree connection Greg KH
2008-08-18 18:43     ` [patch 24/60] dccp: change L/R must have at least one byte in the dccpsf_val field Greg KH
2008-08-18 18:43     ` [patch 25/60] syncookies: Make sure ECN is disabled Greg KH
2008-08-18 18:43     ` [patch 26/60] random32: seeding improvement Greg KH
2008-08-18 18:43     ` [patch 27/60] ipv6: Fix ip6_xmit to send fragments if ipfragok is true Greg KH
2008-08-18 18:44     ` [patch 28/60] sparc64: FUTEX_OP_ANDN fix Greg KH
2008-08-18 18:44     ` [patch 29/60] sparc64: Fix global reg snapshotting on self-cpu Greg KH
2008-08-18 18:44     ` [patch 30/60] sparc64: Do not clobber %g7 in setcontext() trap Greg KH
2008-08-18 18:44     ` [patch 31/60] KVM: task switch: segment base is linear address Greg KH
2008-08-18 18:44     ` [patch 32/60] KVM: task switch: use seg regs provided by subarch instead of reading from GDT Greg KH
2008-08-18 18:44     ` [patch 33/60] KVM: Avoid instruction emulation when event delivery is pending Greg KH
2008-08-18 18:44     ` [patch 34/60] KVM: task switch: translate guest segment limit to virt-extension byte granular field Greg KH
2008-08-18 18:44     ` [patch 35/60] KVM: ia64: Fix irq disabling leak in error handling code Greg KH
2008-08-18 18:44     ` [patch 36/60] r8169: avoid thrashing PCI conf space above RTL_GIGA_MAC_VER_06 Greg KH
2008-08-18 18:44     ` [patch 37/60] ALSA: asoc: restrict sample rate and size in Freescale MPC8610 sound drivers Greg KH
2008-08-18 18:44     ` [patch 38/60] i2c: Fix NULL pointer dereference in i2c_new_probed_device Greg KH
2008-08-18 18:44     ` [patch 39/60] i2c: Let users select algorithm drivers manually again Greg KH
2008-08-18 18:44     ` [patch 40/60] ALSA: ASoC: fix SNDCTL_DSP_SYNC support in Freescale 8610 sound drivers Greg KH
2008-08-18 18:44     ` [patch 41/60] x86: amd opteron TOM2 mask val fix Greg KH
2008-08-18 18:45     ` [patch 42/60] ide: it821x in pass-through mode segfaults in 2.6.26-stable Greg KH
2008-08-18 18:45     ` [patch 43/60] CIFS: Fix compiler warning on 64-bit Greg KH
2008-08-18 18:45     ` [patch 44/60] radeon: misc corrections Greg KH
2008-08-18 18:45     ` [patch 45/60] cs5520: add enablebits checking Greg KH
2008-08-18 18:45     ` [patch 46/60] rtl8187: Fix lockups due to concurrent access to config routine Greg KH
2008-08-18 18:45     ` [patch 47/60] sparc64: Fix end-of-stack checking in save_stack_trace() Greg KH
2008-08-18 18:45     ` [patch 48/60] sparc64: Fix recursion in stack overflow detection handling Greg KH
2008-08-18 18:45     ` [patch 49/60] sparc64: Make global reg dumping even more useful Greg KH
2008-08-18 18:45     ` [patch 50/60] sparc64: Implement IRQ stacks Greg KH
2008-08-18 18:45     ` [patch 51/60] sparc64: Handle stack trace attempts before irqstacks are setup Greg KH
2008-08-18 18:45     ` [patch 52/60] x86: fix spin_is_contended() Greg KH
2008-08-18 18:45     ` [patch 53/60] x86: fix setup code crashes on my old 486 box Greg KH
2008-08-18 19:17       ` H. Peter Anvin
2008-08-18 18:45     ` [patch 54/60] qla2xxx: Add dev_loss_tmo_callbk/terminate_rport_io callback support Greg KH
2008-08-18 18:45     ` [patch 55/60] qla2xxx: Set an rports dev_loss_tmo value in a consistent manner Greg KH
2008-08-18 18:45     ` [patch 56/60] usb-storage: revert DMA-alignment change for Wireless USB Greg KH
2008-08-18 18:45     ` [patch 57/60] usb-storage: automatically recognize bad residues Greg KH
2008-08-18 18:45     ` [patch 58/60] CIFS: properly account for new user= field in SPNEGO upcall string allocation Greg KH
2008-08-18 18:45     ` [patch 59/60] PCI: Limit VPD length for Broadcom 5708S Greg KH
2008-08-18 18:45     ` [patch 60/60] crypto: padlock - fix VIA PadLock instruction usage with irq_ts_save/restore() Greg KH
2008-08-18 19:18 ` [patch 00/49] 2.6.25-stable review Greg KH
2008-08-18 19:19   ` [patch 01/49] USB: usb-storage: quirk around v1.11 firmware on Nikon D4 Greg KH
2008-08-18 19:19   ` [patch 02/49] usb-storage: unusual_devs entries for iRiver T10 and Datafab CF+SM reader Greg KH
2008-08-18 19:19   ` [patch 03/49] usb-serial: dont release unregistered minors Greg KH
2008-08-18 19:19   ` [patch 04/49] USB: pl2023: Remove USB id (4348:5523) handled by ch341 Greg KH
2008-08-18 19:19   ` [patch 05/49] USB: ftdi_sio: Add USB Product Id for ELV HS485 Greg KH
2008-08-18 19:19   ` [patch 06/49] USB: ftdi_sio: add support for Luminance Stellaris Evaluation/Development Kits Greg KH
2008-08-18 19:19   ` [patch 07/49] SCSI: ses: fix VPD inquiry overrun Greg KH
2008-08-18 19:19   ` [patch 08/49] SCSI: scsi_transport_spi: fix oops in revalidate Greg KH
2008-08-18 19:19   ` [patch 09/49] SCSI: hptiop: add more PCI device IDs Greg KH
2008-08-18 19:19   ` [patch 10/49] SCSI: block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler Greg KH
2008-08-18 19:19   ` [patch 11/49] relay: fix "full buffer with exactly full last subbuffer" accounting problem Greg KH
2008-08-18 19:19   ` [patch 12/49] radeonfb: fix accel engine hangs Greg KH
2008-08-18 19:19   ` [patch 13/49] posix-timers: fix posix_timer_event() vs dequeue_signal() race Greg KH
2008-08-18 19:19   ` [patch 14/49] posix-timers: do_schedule_next_timer: fix the setting of ->si_overrun Greg KH
2008-08-18 19:19   ` [patch 15/49] mlock() fix return values Greg KH
2008-08-18 19:19   ` [patch 16/49] matrox maven: fix a broken error path Greg KH
2008-08-18 19:19   ` [patch 17/49] ipvs: Fix possible deadlock in estimator code Greg KH
2008-08-18 19:19   ` [patch 18/49] ide-cd: fix endianity for the error message in cdrom_read_capacity Greg KH
2008-08-18 19:19   ` [patch 19/49] CIFS: mount of IPC$ breaks with iget patch Greg KH
2008-08-18 19:20   ` [patch 20/49] CIFS: if get root inode fails during mount, cleanup tree connection Greg KH
2008-08-18 19:20   ` [patch 21/49] acer-wmi: Fix wireless and bluetooth on early AMW0 v2 laptops Greg KH
2008-08-18 19:20   ` [patch 22/49] dccp: change L/R must have at least one byte in the dccpsf_val field Greg KH
2008-08-18 19:20   ` [patch 23/49] random32: seeding improvement Greg KH
2008-08-18 19:20   ` [patch 24/49] ipv6: Fix ip6_xmit to send fragments if ipfragok is true Greg KH
2008-08-18 19:20   ` [patch 25/49] sparc64: FUTEX_OP_ANDN fix Greg KH
2008-08-18 19:20   ` [patch 26/49] sparc64: Do not clobber %g7 in setcontext() trap Greg KH
2008-08-18 19:20   ` [patch 27/49] uml: fix build when SLOB is enabled Greg KH
2008-08-18 19:20   ` [patch 28/49] uml: fix bad NTP interaction with clock Greg KH
2008-08-18 19:20   ` [patch 29/49] uml: physical memory shouldnt include initial stack Greg KH
2008-08-18 19:20   ` [patch 30/49] uml: track and make up lost ticks Greg KH
2008-08-18 19:20   ` [patch 31/49] uml: missed kmalloc() in pcap_user.c Greg KH
2008-08-18 19:20   ` [patch 32/49] uml: deal with host time going backwards Greg KH
2008-08-18 19:20   ` [patch 33/49] uml: deal with inaccessible address space start Greg KH
2008-08-18 19:20   ` [patch 34/49] uml: missing export of csum_partial() on uml/amd64 Greg KH
2008-08-18 19:20   ` [patch 35/49] uml: memcpy export needs to follow host declaration Greg KH
2008-08-18 19:20   ` [patch 36/49] uml: stub needs to tolerate SIGWINCH Greg KH
2008-08-18 19:20   ` [patch 37/49] uml: work around broken host PTRACE_SYSEMU Greg KH
2008-08-18 19:20   ` [patch 38/49] uml: fix gcc ICEs and unresolved externs Greg KH
2008-08-18 19:20   ` [patch 39/49] uml: Fix boot crash Greg KH
2008-08-18 19:20   ` [patch 40/49] uml: PATH_MAX needs limits.h Greg KH
2008-08-18 19:20   ` [patch 41/49] radeon: misc corrections Greg KH
2008-08-18 19:20   ` [patch 42/49] r8169: avoid thrashing PCI conf space above RTL_GIGA_MAC_VER_06 Greg KH
2008-08-18 19:20   ` [patch 43/49] netfilter: nf_nat_snmp_basic: fix a range check in NAT for SNMP Greg KH
2008-08-18 19:20   ` [patch 44/49] i2c: Fix NULL pointer dereference in i2c_new_probed_device Greg KH
2008-08-18 19:20   ` [patch 45/49] CIFS: Fix compiler warning on 64-bit Greg KH
2008-08-18 19:21   ` [patch 46/49] x86: fix spin_is_contended() Greg KH
2008-08-18 19:21   ` [patch 47/49] x86: fix setup code crashes on my old 486 box Greg KH
2008-08-18 19:21   ` [patch 48/49] qla2xxx: Add dev_loss_tmo_callbk/terminate_rport_io callback support Greg KH
2008-08-18 19:21   ` [patch 49/49] qla2xxx: Set an rports dev_loss_tmo value in a consistent manner Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080818184131.GE29394@suse.de \
    --to=gregkh@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=eteo@redhat.com \
    --cc=jake@lwn.net \
    --cc=jejb@kernel.org \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rbranco@la.checkpoint.com \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=timw@splhi.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox