aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-crypt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 97b407582c03..0042636ad375 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -685,10 +685,8 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
685 685
686 if (async) 686 if (async)
687 kcryptd_queue_io(io); 687 kcryptd_queue_io(io);
688 else { 688 else
689 crypt_inc_pending(io);
690 generic_make_request(clone); 689 generic_make_request(clone);
691 }
692} 690}
693 691
694static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) 692static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
@@ -724,9 +722,12 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
724 722
725 if (atomic_dec_and_test(&io->ctx.pending)) { 723 if (atomic_dec_and_test(&io->ctx.pending)) {
726 /* processed, no running async crypto */ 724 /* processed, no running async crypto */
725 crypt_inc_pending(io);
727 kcryptd_crypt_write_io_submit(io, r, 0); 726 kcryptd_crypt_write_io_submit(io, r, 0);
728 if (unlikely(r < 0)) 727 if (unlikely(r < 0)) {
728 crypt_dec_pending(io);
729 break; 729 break;
730 }
730 } else 731 } else
731 crypt_inc_pending(io); 732 crypt_inc_pending(io);
732 733