From: Milan Broz Make kcryptd_crypt_write_io_submit() responsible for decrementing the pending count after an error. Also fixes a bug in the async path that forgot to decrement it. Signed-off-by: Milan Broz Signed-off-by: Alasdair G Kergon --- drivers/md/dm-crypt.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: linux-2.6.27-rc7/drivers/md/dm-crypt.c =================================================================== --- linux-2.6.27-rc7.orig/drivers/md/dm-crypt.c 2008-09-23 15:11:44.000000000 +0100 +++ linux-2.6.27-rc7/drivers/md/dm-crypt.c 2008-09-23 15:11:45.000000000 +0100 @@ -674,6 +674,7 @@ static void kcryptd_crypt_write_io_submi crypt_free_buffer_pages(cc, clone); bio_put(clone); io->error = -EIO; + crypt_dec_pending(io); return; } @@ -724,10 +725,8 @@ static void kcryptd_crypt_write_convert( /* processed, no running async crypto */ crypt_inc_pending(io); kcryptd_crypt_write_io_submit(io, r, 0); - if (unlikely(r < 0)) { - crypt_dec_pending(io); + if (unlikely(r < 0)) break; - } } else crypt_inc_pending(io);