Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c897feb3dcf3c3300849056ee82b01df7bf66d3c
Commit:     c897feb3dcf3c3300849056ee82b01df7bf66d3c
Parent:     a8e6afa2363de7ee0dea1a3297f6236f421c2dd4
Author:     Heinz Mauelshagen <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 02:33:00 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 9 12:30:47 2007 -0700

    dm io: delay dec_count
    
    Delay decrementing the 'struct io' reference count until after the bio has
    been freed so that a bio destructor function may reference it.  Required by 
a
    later patch.
    
    Signed-off-by: Heinz Mauelshagen <[EMAIL PROTECTED]>
    Signed-off-by: Alasdair G Kergon <[EMAIL PROTECTED]>
    Cc: Milan Broz <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/md/dm-io.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index 8bdc8a8..4d19c45 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -126,7 +126,8 @@ static void dec_count(struct io *io, unsigned int region, 
int error)
 
 static int endio(struct bio *bio, unsigned int done, int error)
 {
-       struct io *io = (struct io *) bio->bi_private;
+       struct io *io;
+       unsigned region;
 
        /* keep going until we've finished */
        if (bio->bi_size)
@@ -135,10 +136,17 @@ static int endio(struct bio *bio, unsigned int done, int 
error)
        if (error && bio_data_dir(bio) == READ)
                zero_fill_bio(bio);
 
-       dec_count(io, bio_get_region(bio), error);
+       /*
+        * The bio destructor in bio_put() may use the io object.
+        */
+       io = bio->bi_private;
+       region = bio_get_region(bio);
+
        bio->bi_max_vecs++;
        bio_put(bio);
 
+       dec_count(io, region, error);
+
        return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to