Don't hook the io until after the target->map function has been
called.
--- diff/drivers/md/dm.c 2002-12-04 16:00:03.000000000 +0000
+++ source/drivers/md/dm.c 2003-01-10 10:07:05.000000000 +0000
@@ -344,15 +344,14 @@
if (!io)
return -ENOMEM;
- io->md = md;
- io->end_io = bh->b_end_io;
- io->context = bh->b_private;
-
r = ti->type->map(ti, bh, rw);
if (r > 0) {
/* hook the end io request fn */
atomic_inc(&md->pending);
+ io->md = md;
+ io->end_io = bh->b_end_io;
+ io->context = bh->b_private;
bh->b_end_io = dec_pending;
bh->b_private = io;