]> git.hungrycats.org Git - linux/commitdiff
dm crypt: fix write endio
authorMilan Broz <mbroz@redhat.com>
Thu, 13 Dec 2007 14:43:05 +0000 (14:43 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 20:01:08 +0000 (12:01 -0800)
patch adfe47702c4726b3e045f9f83178def02833be4c in mainline.

Fix BIO_UPTODATE test for write io.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/dm-crypt.c

index bdc52d6922b7d998f27068cce53ededb302f0b09..b3fcee0fea5a315c12145d80152607e8cc9f6405 100644 (file)
@@ -515,6 +515,9 @@ static int crypt_endio(struct bio *clone, unsigned int done, int error)
        struct crypt_config *cc = io->target->private;
        unsigned read_io = bio_data_dir(clone) == READ;
 
+       if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
+               error = -EIO;
+
        /*
         * free the processed pages, even if
         * it's only a partially completed write
@@ -529,10 +532,8 @@ static int crypt_endio(struct bio *clone, unsigned int done, int error)
        if (!read_io)
                goto out;
 
-       if (unlikely(!bio_flagged(clone, BIO_UPTODATE))) {
-               error = -EIO;
+       if (unlikely(error))
                goto out;
-       }
 
        bio_put(clone);
        io->post_process = 1;