Skip to content

Commit 6c031f4

Browse files
Milan Brozkergon
authored andcommitted
dm crypt: move dec_pending on error into write_io_submit
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 <[email protected]> Signed-off-by: Alasdair G Kergon <[email protected]>
1 parent 1e37bb8 commit 6c031f4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/md/dm-crypt.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
674674
crypt_free_buffer_pages(cc, clone);
675675
bio_put(clone);
676676
io->error = -EIO;
677+
crypt_dec_pending(io);
677678
return;
678679
}
679680

@@ -724,10 +725,8 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
724725
/* processed, no running async crypto */
725726
crypt_inc_pending(io);
726727
kcryptd_crypt_write_io_submit(io, r, 0);
727-
if (unlikely(r < 0)) {
728-
crypt_dec_pending(io);
728+
if (unlikely(r < 0))
729729
break;
730-
}
731730
} else
732731
crypt_inc_pending(io);
733732

0 commit comments

Comments
 (0)