diff options
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r-- | drivers/md/dm-crypt.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index cc189a2bc533..278659975d72 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -504,7 +504,7 @@ static void crypt_endio(struct bio *clone, int error) | |||
504 | { | 504 | { |
505 | struct dm_crypt_io *io = clone->bi_private; | 505 | struct dm_crypt_io *io = clone->bi_private; |
506 | struct crypt_config *cc = io->target->private; | 506 | struct crypt_config *cc = io->target->private; |
507 | unsigned read_io = bio_data_dir(clone) == READ; | 507 | unsigned rw = bio_data_dir(clone); |
508 | 508 | ||
509 | if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error)) | 509 | if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error)) |
510 | error = -EIO; | 510 | error = -EIO; |
@@ -512,20 +512,15 @@ static void crypt_endio(struct bio *clone, int error) | |||
512 | /* | 512 | /* |
513 | * free the processed pages | 513 | * free the processed pages |
514 | */ | 514 | */ |
515 | if (!read_io) { | 515 | if (rw == WRITE) |
516 | crypt_free_buffer_pages(cc, clone); | 516 | crypt_free_buffer_pages(cc, clone); |
517 | goto out; | ||
518 | } | ||
519 | |||
520 | if (unlikely(error)) | ||
521 | goto out; | ||
522 | 517 | ||
523 | bio_put(clone); | 518 | bio_put(clone); |
524 | kcryptd_queue_crypt(io); | ||
525 | return; | ||
526 | 519 | ||
527 | out: | 520 | if (rw == READ && !error) { |
528 | bio_put(clone); | 521 | kcryptd_queue_crypt(io); |
522 | return; | ||
523 | } | ||
529 | 524 | ||
530 | if (unlikely(error)) | 525 | if (unlikely(error)) |
531 | io->error = error; | 526 | io->error = error; |