Message ID | 49AFBE4A.1010605@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Alasdair Kergon |
Headers | show |
Alexander Holler wrote: > Milan Broz schrieb: >> Please Can you try attached patch if helps here? >> (Patch is not perfect, but should help, at least identify that >> it is the same problem I am fixing:-) > > The patch works (I had to add an #include <linux/delay.h> /* msleep */). ok, thanks. > I've tested it using 2.6.28.7 and the script below. With your patch the > script was running over night looping about 400 times without any error. > A crosscheck without the patch needed only 10 iterations to get an oops. > So I assume you have fixed the problem I had. ;) > > There stills seems to be another problem left, I've got 3 times the > kernel-message > > device-mapper: ioctl: unable to remove open device > temporary-cryptsetup-21571 This is bug in cryptsetup related to udev (udev should not touch temporary cryptsetup device) which is fixed upstream, but there is no new release yet (Fedora has this patched, not sure about other distros) see http://code.google.com/p/cryptsetup/source/detail?r=32 and other patches. Milan -- mbroz@redhat.com -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 35bda49..fa37c87 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -95,6 +95,8 @@ struct crypt_config { struct workqueue_struct *io_queue; struct workqueue_struct *crypt_queue; + atomic_t pending; + /* * crypto related data */ @@ -566,6 +568,7 @@ static void crypt_dec_pending(struct dm_crypt_io *io) } mempool_free(io, cc->io_pool); + atomic_dec(&cc->pending); } /* @@ -1113,6 +1116,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto bad_crypt_queue; } + atomic_set(&cc->pending, 0); + ti->private = cc; return 0; @@ -1149,6 +1154,9 @@ static void crypt_dtr(struct dm_target *ti) destroy_workqueue(cc->io_queue); destroy_workqueue(cc->crypt_queue); + while (atomic_read(&cc->pending)) + msleep(1); + if (cc->req) mempool_free(cc->req, cc->req_pool); @@ -1171,8 +1179,11 @@ static void crypt_dtr(struct dm_target *ti) static int crypt_map(struct dm_target *ti, struct bio *bio, union map_info *map_context) { + struct crypt_config *cc = ti->private; struct dm_crypt_io *io; + atomic_inc(&cc->pending); + io = crypt_io_alloc(ti, bio, bio->bi_sector - ti->begin); if (bio_data_dir(io->base_bio) == READ)