Don't hook the io until after the target->map function has been called. --- diff/drivers/md/dm.c 2002-12-03 15:53:51.000000000 +0000 +++ source/drivers/md/dm.c 2002-12-10 10:01:28.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;