linux-stable/drivers/block
Milan Broz 14f2793958 loop: Flush possible running bios when loop device is released.
When there are still queued bios and reference count
drops to zero, loop device must flush all queued bios.

Otherwise it can lead to situation that caller
closes the device, but some bios are still running
and endio() function call later OOpses when uses
unallocated mempool.

This happens for example when running dm-crypt over loop,
here is typical oops backtrace:

 Oops: 0000 [#1] PREEMPT SMP
 EIP is at mempool_free+0x12/0x6b
...
 crypt_dec_pending+0x50/0x54 [dm_crypt]
 crypt_endio+0x9f/0xa7 [dm_crypt]
 crypt_endio+0x0/0xa7 [dm_crypt]
 bio_endio+0x2b/0x2e
 loop_thread+0x37a/0x3b1
 do_lo_send_aops+0x0/0x165
 autoremove_wake_function+0x0/0x33
 loop_thread+0x0/0x3b1
 kthread+0x3b/0x61
 kthread+0x0/0x61
 kernel_thread_helper+0x7/0x10

(But crash is reproducible with different dm targets
running over loop device too.)

Patch fixes it by flushing the bios in release call,
reusing the flush mechanism for switching backing store.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-12-29 08:29:52 +01:00
..
aoe aoe: remove private mac address format function 2008-11-25 00:40:37 -08:00
paride [PATCH] switch pf 2008-10-21 07:47:59 -04:00
amiflop.c [PATCH] switch amiflop 2008-10-21 07:47:38 -04:00
ataflop.c [PATCH] switch ataflop 2008-10-21 07:47:42 -04:00
brd.c [PATCH] switch brd 2008-10-21 07:47:44 -04:00
cciss.c cciss: switch to using hlist for command list management 2008-12-29 08:28:43 +01:00
cciss.h cciss: switch to using hlist for command list management 2008-12-29 08:28:43 +01:00
cciss_cmd.h cciss: switch to using hlist for command list management 2008-12-29 08:28:43 +01:00
cciss_scsi.c cciss: Fix cciss SCSI rescan code to better notice device changes 2008-10-09 08:56:18 +02:00
cciss_scsi.h cciss: Fix cciss SCSI rescan code to better notice device changes 2008-10-09 08:56:18 +02:00
cpqarray.c cpqarry: fix return value of cpqarray_init() 2008-11-06 15:41:17 -08:00
cpqarray.h
cryptoloop.c drivers: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:32 -04:00
DAC960.c [PATCH] switch DAC960 2008-10-21 07:47:36 -04:00
DAC960.h Fix DAC960 driver on machines which don't support 64-bit DMA 2007-09-11 17:21:19 -07:00
floppy.c Create/use more directory structure in the Documentation/ tree. 2008-11-14 17:28:53 +00:00
hd.c hd: WIN_* -> ATA_CMD_* 2008-10-10 22:39:21 +02:00
ida_cmd.h
ida_ioctl.h
Kconfig Create/use more directory structure in the Documentation/ tree. 2008-11-14 17:28:53 +00:00
loop.c loop: Flush possible running bios when loop device is released. 2008-12-29 08:29:52 +01:00
Makefile move ide/legacy/hd.c to drivers/block/ 2008-07-16 20:33:47 +02:00
nbd.c nbd: tell the block layer that it is not a rotational device 2008-12-29 08:29:50 +01:00
pktcdvd.c pktcdvd: remove broken dev_t export of class devices 2008-12-10 10:03:32 -08:00
ps3disk.c block: don't depend on consecutive minor space 2008-10-09 08:56:05 +02:00
smart1,2.h
sunvdc.c sparc64: Apply const or __initdata to vio_device_id[] 2008-09-01 01:48:52 -07:00
swim3.c [PATCH] switch swim3 2008-10-21 07:48:03 -04:00
sx8.c block: replace remaining __FUNCTION__ occurrences 2008-04-21 09:51:04 +02:00
ub.c ub: stub pre_reset and post_reset to fix oops 2008-11-13 14:45:04 -08:00
umem.c Cleanup umem driver: fix most checkpatch warnings, conform to kernel 2007-12-18 08:29:28 +01:00
umem.h drivers/block/umem: trim trailing whitespace 2007-10-10 09:25:59 +02:00
viodasd.c [PATCH] switch viodasd 2008-10-21 07:48:07 -04:00
virtio_blk.c virtio_blk: set queue paravirt flag 2008-12-29 08:28:41 +01:00
xd.c [PATCH] switch xd 2008-10-21 07:48:11 -04:00
xd.h [PATCH] switch xd 2008-10-21 07:48:11 -04:00
xen-blkfront.c xen-blkfront: set queue paravirt flag 2008-12-29 08:28:41 +01:00
xsysace.c xsysace: Fix driver to use resource_size_t instead of unsigned long 2008-11-14 10:21:57 -07:00
z2ram.c [PATCH] switch z2ram 2008-10-21 07:48:17 -04:00