diff options
| author | Andrew Morton <akpm@osdl.org> | 2003-09-21 01:42:13 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-09-21 01:42:13 -0700 |
| commit | 69d858195d876e745eddfbd7fa4c8d1adbc68be1 (patch) | |
| tree | 9c0becbd11d3823fdac36466a5d2150cff486ea1 | |
| parent | 1669e6e99503a394ecd360f2cbed7e9a372939e0 (diff) | |
[PATCH] bio_dirty_fn() page leak fix
bio_dirty_fn() needs to drop its ref against each remaining page in the BIO
before releasing the BIO.
| -rw-r--r-- | fs/bio.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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; } |
