Skip to content

Commit

Permalink
dm crypt: move dec_pending on error into write_io_submit
Browse files Browse the repository at this point in the history
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 <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Milan Broz authored and Alasdair G Kergon committed Oct 10, 2008
1 parent 1e37bb8 commit 6c031f4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
crypt_free_buffer_pages(cc, clone);
bio_put(clone);
io->error = -EIO;
crypt_dec_pending(io);
return;
}

Expand Down Expand Up @@ -724,10 +725,8 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
/* 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);

Expand Down

0 comments on commit 6c031f4

Please sign in to comment.