linux/drivers
James Bottomley ea038f63ac [SCSI] fix oops during scsi scanning
Chris Webb reported:
  p0# uname -a
  Linux f7ea8425-d45b-490f-a738-d181d0df6963.host.elastichosts.com 2.6.30.4-elastic-lon-p #2 SMP PREEMPT Thu Aug 20 14:30:50 BST 2009 x86_64 Intel(R) Xeon(R) CPU E5420 @ 2.50GHz GenuineIntel GNU/Linux
  p0# zgrep SCAN_ASYNC /proc/config.gz
  # CONFIG_SCSI_SCAN_ASYNC is not set

  p0# cat /var/log/kern/2009-08-20
  [...]
  15:27:10.485 kernel: scsi9 : iSCSI Initiator over TCP/IP
  15:27:11.493 kernel: scsi 9:0:0:0: RAID              IET      Controller       0001 PQ: 0 ANSI: 5
  15:27:11.493 kernel: scsi 9:0:0:0: Attached scsi generic sg6 type 12
  15:27:11.495 kernel: scsi 9:0:0:1: Direct-Access     IET      VIRTUAL-DISK     0001 PQ: 0 ANSI: 5
  15:27:11.495 kernel: sd 9:0:0:1: Attached scsi generic sg7 type 0
  15:27:11.495 kernel: sd 9:0:0:1: [sdg] 4194304 512-byte hardware sectors: (2.14 GB/2.00 GiB)
  15:27:11.495 kernel: sd 9:0:0:1: [sdg] Write Protect is off
  15:27:11.495 kernel: sd 9:0:0:1: [sdg] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
  15:27:13.012 kernel: sdg:<6>scsi 9:0:0:1: [sdg] Unhandled error code
  15:27:13.012 kernel: scsi 9:0:0:1: [sdg] Result: hostbyte=0x07 driverbyte=0x00
  15:27:13.012 kernel: end_request: I/O error, dev sdg, sector 0
  15:27:13.012 kernel: Buffer I/O error on device sdg, logical block 0
  15:27:13.012 kernel: ldm_validate_partition_table(): Disk read failed.
  15:27:13.012 kernel: unable to read partition table
  15:27:13.014 kernel: BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
  15:27:13.014 kernel: IP: [<ffffffff803f0d77>] disk_part_iter_next+0x74/0xfd
  15:27:13.014 kernel: PGD 82ad0b067 PUD 82cd7e067 PMD 0 
  15:27:13.014 kernel: Oops: 0000 [#1] PREEMPT SMP 
  15:27:13.014 kernel: last sysfs file: /sys/devices/platform/host9/session4/iscsi_session/session4/ifacename
  15:27:13.014 kernel: CPU 5 
  15:27:13.014 kernel: Modules linked in:
  15:27:13.014 kernel: Pid: 13999, comm: async/0 Not tainted 2.6.30.4-elastic-lon-p #2 X7DBN
  15:27:13.014 kernel: RIP: 0010:[<ffffffff803f0d77>]  [<ffffffff803f0d77>] disk_part_iter_next+0x74/0xfd
  15:27:13.014 kernel: RSP: 0018:ffff88066afa3dd0  EFLAGS: 00010246
  15:27:13.014 kernel: RAX: ffff88082b58a000 RBX: ffff88066afa3e00 RCX: 0000000000000000
  15:27:13.014 kernel: RDX: 0000000000000000 RSI: ffff88082b58a000 RDI: 0000000000000000
  15:27:13.014 kernel: RBP: ffff88066afa3df0 R08: ffff88066afa2000 R09: ffff8806a204f000
  15:27:13.014 kernel: R10: 000000fb12c7d274 R11: ffff8806c2bf0628 R12: ffff88066afa3e00
  15:27:13.014 kernel: R13: ffff88082c829a00 R14: 0000000000000000 R15: ffff8806bc50c920
  15:27:13.014 kernel: FS:  0000000000000000(0000) GS:ffff88002818a000(0000) knlGS:0000000000000000
  15:27:13.014 kernel: CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
  15:27:13.014 kernel: CR2: 0000000000000010 CR3: 000000082ade3000 CR4: 00000000000426e0
  15:27:13.014 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  15:27:13.014 kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
  15:27:13.014 kernel: Process async/0 (pid: 13999, threadinfo ffff88066afa2000, task ffff8806c2bf05e0)
  15:27:13.014 kernel: Stack:
  15:27:13.014 kernel: 0000000000000000 ffff88066afa3e00 ffff88066afa3e00 ffff88082c829a00
  15:27:13.014 kernel: ffff88066afa3e40 ffffffff80306feb ffff88082b58a000 0000000000000000
  15:27:13.014 kernel: 0000000000000001 ffff8806bc50c920 ffff88066afa3e40 ffff88082b58a000
  15:27:13.014 kernel: Call Trace:
  15:27:13.014 kernel: [<ffffffff80306feb>] register_disk+0x122/0x13a
  15:27:13.014 kernel: [<ffffffff803f0b0f>] add_disk+0xaa/0x106
  15:27:13.014 kernel: [<ffffffff80493609>] sd_probe_async+0x198/0x25b
  15:27:13.014 kernel: [<ffffffff80270482>] async_thread+0x10c/0x20d
  15:27:13.014 kernel: [<ffffffff802545ff>] ? default_wake_function+0x0/0xf
  15:27:13.014 kernel: [<ffffffff80270376>] ? async_thread+0x0/0x20d
  15:27:13.014 kernel: [<ffffffff8026ad89>] kthread+0x55/0x80
  15:27:13.014 kernel: [<ffffffff8022be6a>] child_rip+0xa/0x20
  15:27:13.014 kernel: [<ffffffff8026ad34>] ? kthread+0x0/0x80
  15:27:13.014 kernel: [<ffffffff8022be60>] ? child_rip+0x0/0x20
  15:27:13.014 kernel: Code: c8 ff 80 e1 0c b9 00 00 00 00 0f 44 c1 41 83 cd ff 48 8d 7a 20 48 be ff ff ff ff 08 00 00 00 48 b9 00 00 00 00 08 00 00 00 eb 50 <8b> 42 10 41 bd 01 00 00 00 eb db 4c 63 c2 4e 8d 04 c7 4d 8b 20 
  15:27:13.015 kernel: RIP  [<ffffffff803f0d77>] disk_part_iter_next+0x74/0xfd
  15:27:13.015 kernel: RSP <ffff88066afa3dd0>
  15:27:13.015 kernel: CR2: 0000000000000010
  15:27:13.015 kernel: ---[ end trace 6104b56ef5590e25 ]---

The problem is caused because the async scanning split in sd.c doesn't hold
any reference to the device when it kicks off the async piece.  What's
happening is that an iSCSI disconnect is destorying the device again *before*
the async sd scanning thread even starts.  Fix this by taking a reference
before starting the thread and dropping it again when the thread completes.

Reported-by: Chris Webb <chris@arachsys.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2009-09-12 09:35:34 -05:00
..
accessibility
acpi Merge branch 'misc-2.6.31' into release 2009-08-02 12:55:51 -04:00
amba [ARM] amba: fix amba device resources 2009-07-05 22:39:08 +01:00
ata ahci: add workaround for on-board 5723s on some gigabyte boards 2009-08-12 06:21:32 -04:00
atm
auxdisplay
base PM / Driver Core: Kill dev_pm_ops platform warning for now 2009-08-10 23:41:18 +02:00
block mg_disk: Add missing ready status check on mg_write() 2009-07-28 08:57:33 +02:00
bluetooth headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
cdrom
char pty: fix data loss when stopped (^S/^Q) 2009-08-10 13:31:18 -07:00
clocksource sh: CMT suspend/resume 2009-08-15 12:58:45 +09:00
connector connector: maintainer/mail update. 2009-07-21 12:43:51 -07:00
cpufreq [CPUFREQ] Make cpufreq suspend code conditional on powerpc. 2009-08-04 14:32:11 -04:00
cpuidle
crypto
dca
dio
dma Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx 2009-07-30 16:46:31 -07:00
edac amd64_edac: print debug statements only on error 2009-08-04 12:10:06 +02:00
eisa
firewire Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2009-07-06 14:03:44 -07:00
firmware
gpio headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
gpu drm/radeon: add GET_PARAM/INFO support for Z pipes 2009-08-21 19:10:30 +10:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2009-07-22 09:30:07 -07:00
hwmon hwmon: (asus_atk0110) Fix upper limit readings 2009-07-28 16:31:39 +02:00
i2c i2c-stu300: I2C STU300 stability updates 2009-08-20 22:27:58 +01:00
ide ide-tape: Don't leak kernel stack information 2009-07-21 20:36:25 -07:00
idle
ieee1394 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2009-07-06 14:03:44 -07:00
ieee802154
infiniband Merge branches 'ehca', 'misc', 'mlx4', 'mthca' and 'nes' into for-linus 2009-06-23 10:38:47 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2009-08-07 10:42:14 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-08-04 15:38:34 -07:00
leds Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
lguest lguest and virtio: cleanup struct definitions to Linux style. 2009-07-30 16:03:46 +09:30
macintosh powerpc/pmac: Fix DMA ops for MacIO devices 2009-06-26 14:37:25 +10:00
mca
md [SCSI] scsi_dh: Use scsi_dh_set_params() in multipath. 2009-08-22 17:52:15 -05:00
media V4L/DVB (12441): siano: read buffer overflow 2009-08-13 20:39:14 -03:00
memstick
message [SCSI] mptsas : Bump version to 3.04.12 2009-09-12 09:35:29 -05:00
mfd mfd: twl4030 irq fixes 2009-08-04 20:31:32 +02:00
misc [SCSI] ses: update enclosure data on hot add 2009-08-22 17:52:14 -05:00
mmc drivers/mmc: correct error-handling code 2009-08-07 10:39:56 -07:00
mtd Remove zero-length file drivers/mtd/maps/sbc8240.c 2009-08-12 06:29:57 -04:00
net e1000e: fix use of pci_enable_pcie_error_reporting 2009-08-15 18:52:59 -07:00
nubus
of of/mdio: Add support function for Ethernet fixed-link property 2009-07-22 09:27:18 -07:00
oprofile oprofile: reset bt_lost_no_mapping with other stats 2009-07-10 12:35:36 +02:00
parisc parisc: hppb.c - fix printk format strings 2009-08-02 15:42:39 +02:00
parport parport/serial: add support for NetMos 9901 Multi-IO card 2009-06-30 18:55:59 -07:00
pci PCI: check saved state before restore 2009-08-20 09:08:45 -07:00
pcmcia Remove multiple KERN_ prefixes from printk formats 2009-07-08 10:30:03 -07:00
platform Merge branch 'bugzilla-13825' into release 2009-08-02 12:36:01 -04:00
pnp Merge branches 'acerhdf', 'acpi-pci-bind', 'bjorn-pci-root', 'bugzilla-12904', 'bugzilla-13121', 'bugzilla-13396', 'bugzilla-13533', 'bugzilla-13612', 'c3_lock', 'hid-cleanups', 'misc-2.6.31', 'pdc-leak-fix', 'pnpacpi', 'power_nocheck', 'thinkpad_acpi', 'video' and 'wmi' into release 2009-06-24 01:19:50 -04:00
power Merge git://git.infradead.org/users/cbou/battery-2.6.31 2009-07-30 16:45:53 -07:00
pps
ps3
rapidio
regulator
rtc rtc: mark if rtc-cmos drivers were successfully registered 2009-07-29 19:10:35 -07:00
s390 [SCSI] zfcp: optimize zfcp_qdio_account 2009-09-05 08:49:49 -05:00
sbus
scsi [SCSI] fix oops during scsi scanning 2009-09-12 09:35:34 -05:00
serial ARM: S3C64XX: serial: Fix a typo in Kconfig 2009-08-14 00:43:46 +01:00
sh
sn
spi spi_s3c24xx: fix transfer setup code 2009-08-18 16:31:13 -07:00
ssb Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-07-09 20:33:18 -07:00
staging Staging: rspiusb: Fix buffer overflow 2009-08-07 16:12:03 -07:00
tc
telephony headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
thermal
uio
usb USB: fix oops on disconnect in cdc-acm 2009-08-07 16:05:14 -07:00
uwb
video sh: skip disabled LCDC channels 2009-08-15 12:58:42 +09:00
virtio virtio: refactor find_vqs 2009-07-30 16:03:45 +09:30
vlynq vlynq: fix typo in Kconfig to enable debugging 2009-07-06 13:57:03 -07:00
w1 drivers/w1/masters/omap_hdq.c: fix missing mutex unlock 2009-08-07 10:39:55 -07:00
watchdog Merge master.kernel.org:/home/rmk/linux-2.6-arm 2009-08-07 10:46:51 -07:00
xen xen: Use kcalloc() in xen_init_IRQ() 2009-07-01 11:19:47 +02:00
zorro
Kconfig
Makefile