lkml.org 
[lkml]   [2008]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [dm-crypt] Kernel 2.6.25-rc4: lock up when writing onto DM-Crypt volume
Ulrich Lukas wrote:

> I observed a reproducible bug after switching from Linux 2.6.24 to the
> latest 2.6.25-rc4 kernel. On Linux 2.6.24 I had no such problem.
>
> When writing to a slightly bigger DM-Crypt-LUKS volume, I experience
> lock-ups in the form of stuck, non-terminating, non-"kill -9"-able
> processes
Please could you try patch below?
Milan

--
dm-crypt: Fix reference counting in crypto context.

Fix regression in dm-crypt introduced in commit
3a7f6c990ad04e6f576a159876c602d14d6f7fef
(dm crypt: use async crypto).

If the write request is splitted, ctx->context
is not properly initialized again and crypt_convert
return incorrectly processed return value like
asynchronous request.

Fix by moving pending counter manipulation
directly to crypt_convert call.

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
drivers/md/dm-crypt.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index b04f98d..47bbb03 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -331,14 +331,7 @@ static void crypt_convert_init(struct crypt_config *cc,
ctx->idx_out = bio_out ? bio_out->bi_idx : 0;
ctx->sector = sector + cc->iv_offset;
init_completion(&ctx->restart);
- /*
- * Crypto operation can be asynchronous,
- * ctx->pending is increased after request submission.
- * We need to ensure that we don't call the crypt finish
- * operation before pending got incremented
- * (dependent on crypt submission return code).
- */
- atomic_set(&ctx->pending, 2);
+ atomic_set(&ctx->pending, 0);
}

static int crypt_convert_block(struct crypt_config *cc,
@@ -413,6 +406,15 @@ static int crypt_convert(struct crypt_config *cc,
{
int r = 0;

+ /*
+ * Crypto operation can be asynchronous,
+ * ctx->pending is increased after request submission.
+ * We need to ensure that we don't call the crypt finish
+ * operation before pending got incremented
+ * (dependent on crypt submission return code).
+ */
+ atomic_add(2, &ctx->pending);
+
while(ctx->idx_in < ctx->bio_in->bi_vcnt &&
ctx->idx_out < ctx->bio_out->bi_vcnt) {




\
 
 \ /
  Last update: 2008-03-14 10:23    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site