svn commit: r220299 - head/sys/geom/eli
Mikolaj Golub
trociny at FreeBSD.org
Sun Apr 3 17:38:13 UTC 2011
Author: trociny
Date: Sun Apr 3 17:38:12 2011
New Revision: 220299
URL: http://svn.freebsd.org/changeset/base/220299
Log:
In g_eli_read_done() and g_eli_write_done(), for a bio with
bio_children > 1, g_destroy_bio() is never called and the bio
leaks. Fix this by calling g_destroy_bio() earlier, before the check.
Submitted by: Victor Balada Diaz <victor at bsdes.net> (initial version)
Approved by: pjd (mentor)
MFC after: 1 week
Modified:
head/sys/geom/eli/g_eli.c
Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c Sun Apr 3 17:36:32 2011 (r220298)
+++ head/sys/geom/eli/g_eli.c Sun Apr 3 17:38:12 2011 (r220299)
@@ -161,13 +161,13 @@ g_eli_read_done(struct bio *bp)
pbp = bp->bio_parent;
if (pbp->bio_error == 0)
pbp->bio_error = bp->bio_error;
+ g_destroy_bio(bp);
/*
* Do we have all sectors already?
*/
pbp->bio_inbed++;
if (pbp->bio_inbed < pbp->bio_children)
return;
- g_destroy_bio(bp);
sc = pbp->bio_to->geom->softc;
if (pbp->bio_error != 0) {
G_ELI_LOGREQ(0, pbp, "%s() failed", __func__);
@@ -203,6 +203,7 @@ g_eli_write_done(struct bio *bp)
if (bp->bio_error != 0)
pbp->bio_error = bp->bio_error;
}
+ g_destroy_bio(bp);
/*
* Do we have all sectors already?
*/
@@ -216,7 +217,6 @@ g_eli_write_done(struct bio *bp)
pbp->bio_error);
pbp->bio_completed = 0;
}
- g_destroy_bio(bp);
/*
* Write is finished, send it up.
*/
More information about the svn-src-head
mailing list