1
0
Fork 0
alistair23-linux/drivers
Linus Torvalds 7b3d9545f9 Revert "scsi: revert "[SCSI] Get rid of scsi_cmnd->done""
This reverts commit ac40532ef0, which gets
us back the original cleanup of 6f5391c283.

It turns out that the bug that was triggered by that commit was
apparently not actually triggered by that commit at all, and just the
testing conditions had changed enough to make it appear to be due to it.

The real problem seems to have been found by Peter Osterlund:

  "pktcdvd sets it [block device size] when opening the /dev/pktcdvd
   device, but when the drive is later opened as /dev/scd0, there is
   nothing that sets it back.  (Btw, 40944 is possible if the disk is a
   CDRW that was formatted with "cdrwtool -m 10236".)

   The problem is that pktcdvd opens the cd device in non-blocking mode
   when pktsetup is run, and doesn't close it again until pktsetup -d is
   run.  The effect is that if you meanwhile open the cd device,
   blkdev.c:do_open() doesn't call bd_set_size() because
   bdev->bd_openers is non-zero."

In particular, to repeat the bug (regardless of whether commit
6f5391c283 is applied or not):

  " 1. Start with an empty drive.
    2. pktsetup 0 /dev/scd0
    3. Insert a CD containing an isofs filesystem.
    4. mount /dev/pktcdvd/0 /mnt/tmp
    5. umount /mnt/tmp
    6. Press the eject button.
    7. Insert a DVD containing a non-writable filesystem.
    8. mount /dev/scd0 /mnt/tmp
    9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
    10. If the DVD contains data beyond the physical size of a CD, you
        get I/O errors in the terminal, and dmesg reports lots of
        "attempt to access beyond end of device" errors."

which in turn is because the nested open after the media change won't
cause the size to be set properly (because the original open still holds
the block device, and we only do the bd_set_size() when we don't have
other people holding the device open).

The proper fix for that is probably to just do something like

	bdev->bd_inode->i_size = (loff_t)get_capacity(disk)<<9;

in fs/block_dev.c:do_open() even for the cases where we're not the
original opener (but *not* call bd_set_size(), since that will also
change the block size of the device).

Cc: Peter Osterlund <petero2@telia.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-06 10:17:12 -08:00
..
acorn/char unicode diacritics support 2007-10-17 08:42:52 -07:00
acpi Pull bugzilla-9362 into release branch 2007-12-14 15:14:52 -05:00
amba
ata pata_hpt37x: Fix HPT374 detection 2007-12-19 14:29:01 -08:00
atm [ATM]: Spelling fixes 2007-12-20 14:05:37 -08:00
auxdisplay
base create /sys/.../power when CONFIG_PM is set 2007-11-28 13:53:53 -08:00
block Cleanup umem driver: fix most checkpatch warnings, conform to kernel 2007-12-18 08:29:28 +01:00
bluetooth [Bluetooth] Add generic driver for Bluetooth USB devices 2007-10-22 02:59:46 -07:00
cdrom SG: audit of drivers that use blk_rq_map_sg() 2007-10-24 13:21:21 +02:00
char tty: fix logic change introduced by wait_event_interruptible_timeout() 2007-12-23 12:54:37 -08:00
clocksource
connector [CONNECTOR]: Return proper error code in cn_call_callback() 2008-01-04 03:55:37 -08:00
cpufreq drivers/cpufreq/cpufreq_stats.c section fix 2007-12-17 19:28:16 -08:00
cpuidle cpuidle: remove unused exports 2007-10-29 17:27:50 -04:00
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2007-12-27 21:45:01 -08:00
dca I/OAT: Add DCA services 2007-10-16 09:43:09 -07:00
dio
dma I/OAT: fix null device in call to dev_err() 2007-12-17 19:28:17 -08:00
edac i5000_edac: no need to __stringify() KBUILD_BASENAME 2007-11-14 18:45:41 -08:00
eisa signedness: module_param_array nump argument 2007-10-14 12:41:52 -07:00
firewire firewire: OHCI 1.0 Isochronous Receive support 2007-12-10 21:55:19 +01:00
firmware define global BIT macro 2007-10-19 11:53:42 -07:00
hid HID: Don't access input_dev->private directly 2007-10-31 13:30:35 +01:00
hwmon hwmon: (w83627ehf) Be more careful when changing VID input level 2008-01-03 07:33:31 -05:00
i2c i2c/isp1301_omap: Build fix 2007-12-12 13:45:25 +01:00
ide cmd64x: fix hwif->chipset setup 2007-12-24 15:23:44 +01:00
ieee1394 ieee1394: iso and async streams: s/g list fix 2007-11-04 14:31:16 +01:00
infiniband IB/srp: Fix list corruption/oops on module reload 2008-01-03 10:25:27 -08:00
input spi: use simplified spi_sync() calling convention 2007-12-05 09:21:19 -08:00
isdn [ISDN]: i4l: Fix DLE handling for i4l-audio 2008-01-04 03:55:44 -08:00
kvm KVM: SVM: Fix FPU leak while emulating clts 2007-11-27 15:38:18 +02:00
leds leds: Fix locomo LED driver oops 2007-12-31 23:11:11 +00:00
lguest virtio: fix module/device unloading 2007-11-19 11:20:42 +11:00
macintosh drivers/macintosh/via-pmu.c: Added a missing iounmap 2007-12-17 19:28:16 -08:00
mca
md dm crypt: use bio_add_page 2007-12-20 17:32:13 +00:00
media V4L/DVB (6876): ivtv: mspx4xx needs a longer i2c udelay 2007-12-24 08:07:36 -02:00
message i2o: debug messages corrected 2007-11-05 15:12:31 -08:00
mfd MFD: SM501 debug typo fix 2007-11-29 09:24:53 -08:00
misc ACPI: thinkpad-acpi: fix lenovo keymap for brightness 2007-12-13 21:59:59 -05:00
mmc sdhci: support JMicron JMB38x chips 2007-12-12 20:01:00 +01:00
mtd Eliminate pointless casts from void* in a few driver irq handlers. 2007-10-23 19:53:16 -04:00
net [CASSINI]: Bump driver version and release date. 2008-01-04 03:55:30 -08:00
nubus
of [SPARC/64]: Consolidate of_register_driver 2007-10-17 21:17:42 -07:00
oprofile oProfile: oops when profile_pc() returns ~0LU 2007-11-14 18:45:37 -08:00
parisc [PARISC] lba_pci: pci_claim_resources disabled expansion roms 2007-12-06 09:38:26 -08:00
parport parport: "dev->timeslice" is an unsigned long, not an int 2007-12-17 19:28:15 -08:00
pci [PCI] Do not enable CRS Software Visibility by default 2007-12-27 21:21:36 -08:00
pcmcia pcmcia: remove pxa2xx_lubbock build warning 2007-12-23 12:54:37 -08:00
pnp drivers/pnp/resource.c: Add missing pci_dev_put 2007-11-29 09:24:52 -08:00
power Merge git://git.infradead.org/battery-2.6 2007-10-22 19:20:52 -07:00
ps3 ps3: vuart: fix error path locking 2007-12-23 12:54:37 -08:00
rapidio
rtc rtc-at32ap700x: fix irq init oops 2007-12-17 19:28:15 -08:00
s390 [S390]: Fix use of skb after netif_rx 2007-12-11 02:45:29 -08:00
sbus [WATCHDOG] Sbus: cpwatchdog, remove SPIN_LOCK_UNLOCKED 2007-11-19 21:09:52 +00:00
scsi Revert "scsi: revert "[SCSI] Get rid of scsi_cmnd->done"" 2008-01-06 10:17:12 -08:00
serial [SERIAL]: Fix section mismatches in Sun serial console drivers. 2007-12-29 01:19:49 -08:00
sh superhyway: Handle device_register() retval properly. 2007-11-07 11:13:55 +09:00
sn
spi atmel_spi: reload RCR before TCR 2007-12-10 19:43:55 -08:00
ssb ssb: Fix PCMCIA-host lowlevel bus access 2007-11-10 22:01:53 -08:00
tc lk201: remove obsolete driver 2007-10-17 08:42:57 -07:00
telephony telephony: phonedev panics if unregistering device not registered [Bug 9266] 2007-11-05 15:12:33 -08:00
uio
usb USB: New device ID for the CP2101 driver 2007-12-22 23:14:33 -08:00
video ps3fb: Fix ps3fb free_irq() dev_id 2007-12-19 14:27:30 -08:00
virtio virtio: fix module/device unloading 2007-11-19 11:20:42 +11:00
w1 W1: fix memset size error 2007-11-14 18:45:36 -08:00
watchdog [WATCHDOG] add Nano 7240 driver 2007-12-04 16:48:06 +00:00
xen Add missing newlines to some uses of dev_<level> messages 2007-10-18 14:37:28 -07:00
zorro Amiga zorro bus: Add missing zorro_device_remove() 2007-11-26 19:15:31 -08:00
Kconfig Virtio interface 2007-10-23 15:49:54 +10:00
Makefile Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2007-10-23 16:37:29 -07:00