drbd: Keep a reference to the bio until the completion handler finished
authorPhilipp Reisner <philipp.reisner@linbit.com>
Mon, 4 Jul 2011 09:14:31 +0000 (11:14 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Wed, 9 May 2012 08:28:51 +0000 (10:28 +0200)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_actlog.c
drivers/block/drbd/drbd_worker.c

index aee599fad960f246244071e4741d3c0e52da68f9..528342c82ba1a8dec903b4302820216abd6a2e31 100644 (file)
@@ -118,6 +118,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
        bio->bi_end_io = drbd_md_io_complete;
        bio->bi_rw = rw;
 
+       bio_get(bio); /* one bio_put() is in the completion handler */
        atomic_inc(&mdev->md_io_in_use); /* drbd_md_put_buffer() is in the completion handler */
        if (drbd_insert_fault(mdev, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD))
                bio_endio(bio, -EIO);
index ee8303680dd88f460530e1cb97aefb5f60aa1ff0..6dcd9f6e78c81370e33b6749238824fc4e37ad75 100644 (file)
@@ -79,6 +79,7 @@ void drbd_md_io_complete(struct bio *bio, int error)
 
        md_io->done = 1;
        wake_up(&mdev->misc_wait);
+       bio_put(bio);
        drbd_md_put_buffer(mdev);
 }