summaryrefslogtreecommitdiff
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r--drivers/md/dm-crypt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 744b80c608e5..59da573cf994 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1102,6 +1102,7 @@ static void crypt_endio(struct bio *clone)
struct dm_crypt_io *io = clone->bi_private;
struct crypt_config *cc = io->cc;
unsigned rw = bio_data_dir(clone);
+ int error;
/*
* free the processed pages
@@ -1109,15 +1110,16 @@ static void crypt_endio(struct bio *clone)
if (rw == WRITE)
crypt_free_buffer_pages(cc, clone);
+ error = clone->bi_error;
bio_put(clone);
- if (rw == READ && !clone->bi_error) {
+ if (rw == READ && !error) {
kcryptd_queue_crypt(io);
return;
}
- if (unlikely(clone->bi_error))
- io->error = clone->bi_error;
+ if (unlikely(error))
+ io->error = error;
crypt_dec_pending(io);
}