linux/drivers/md
Milan Broz b35f8caa08 dm crypt: wait for endio to complete before destruction
The following oops has been reported when dm-crypt runs over a loop device.

...
[   70.381058] Process loop0 (pid: 4268, ti=cf3b2000 task=cf1cc1f0 task.ti=cf3b2000)
...
[   70.381058] Call Trace:
[   70.381058]  [<d0d76601>] ? crypt_dec_pending+0x5e/0x62 [dm_crypt]
[   70.381058]  [<d0d767b8>] ? crypt_endio+0xa2/0xaa [dm_crypt]
[   70.381058]  [<d0d76716>] ? crypt_endio+0x0/0xaa [dm_crypt]
[   70.381058]  [<c01a2f24>] ? bio_endio+0x2b/0x2e
[   70.381058]  [<d0806530>] ? dec_pending+0x224/0x23b [dm_mod]
[   70.381058]  [<d08066e4>] ? clone_endio+0x79/0xa4 [dm_mod]
[   70.381058]  [<d080666b>] ? clone_endio+0x0/0xa4 [dm_mod]
[   70.381058]  [<c01a2f24>] ? bio_endio+0x2b/0x2e
[   70.381058]  [<c02bad86>] ? loop_thread+0x380/0x3b7
[   70.381058]  [<c02ba8a1>] ? do_lo_send_aops+0x0/0x165
[   70.381058]  [<c013754f>] ? autoremove_wake_function+0x0/0x33
[   70.381058]  [<c02baa06>] ? loop_thread+0x0/0x3b7

When a table is being replaced, it waits for I/O to complete
before destroying the mempool, but the endio function doesn't
call mempool_free() until after completing the bio.

Fix it by swapping the order of those two operations.

The same problem occurs in dm.c with md referenced after dec_pending.
Again, we swap the order.

Cc: stable@kernel.org
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2009-03-16 17:44:36 +00:00
..
raid6test
.gitignore
bitmap.c
dm-bio-list.h
dm-bio-record.h
dm-crypt.c dm crypt: wait for endio to complete before destruction 2009-03-16 17:44:36 +00:00
dm-delay.c
dm-exception-store.c
dm-exception-store.h
dm-io.c
dm-ioctl.c
dm-kcopyd.c
dm-linear.c
dm-log.c
dm-mpath.c
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-raid1.c
dm-region-hash.c
dm-round-robin.c
dm-snap-persistent.c
dm-snap-transient.c
dm-snap.c
dm-snap.h
dm-stripe.c
dm-sysfs.c
dm-table.c
dm-target.c
dm-uevent.c
dm-uevent.h
dm-zero.c
dm.c dm crypt: wait for endio to complete before destruction 2009-03-16 17:44:36 +00:00
dm.h
faulty.c
Kconfig
linear.c
Makefile
md.c
mktables.c
multipath.c
raid0.c
raid1.c
raid5.c
raid6.h
raid6algos.c
raid6altivec.uc
raid6int.uc
raid6mmx.c
raid6recov.c
raid6sse1.c
raid6sse2.c
raid6x86.h
raid10.c
unroll.pl