bio_dirty_fn() needs to drop its ref against each remaining page in the BIO
before releasing the BIO.



 25-akpm/fs/bio.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+)

diff -puN fs/bio.c~bio_dirty_fn-release-fix fs/bio.c
--- 25/fs/bio.c~bio_dirty_fn-release-fix	Thu Sep 18 13:13:21 2003
+++ 25-akpm/fs/bio.c	Thu Sep 18 13:15:14 2003
@@ -558,6 +558,19 @@ void bio_set_pages_dirty(struct bio *bio
 	}
 }
 
+void bio_release_pages(struct bio *bio)
+{
+	struct bio_vec *bvec = bio->bi_io_vec;
+	int i;
+
+	for (i = 0; i < bio->bi_vcnt; i++) {
+		struct page *page = bvec[i].bv_page;
+
+		if (page)
+			put_page(page);
+	}
+}
+
 /*
  * bio_check_pages_dirty() will check that all the BIO's pages are still dirty.
  * If they are, then fine.  If, however, some pages are clean then they must
@@ -592,6 +605,7 @@ static void bio_dirty_fn(void *data)
 		struct bio *next = bio->bi_private;
 
 		bio_set_pages_dirty(bio);
+		bio_release_pages(bio);
 		bio_put(bio);
 		bio = next;
 	}

_