Date: Sat, 2 Apr 2011 12:17:50 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Mikolaj Golub <trociny@freebsd.org> Cc: Victor Balada Diaz <victor@bsdes.net>, stable@freebsd.org, Kostik Belousov <kib@FreeBSD.org> Subject: Re: geli(4) memory leak Message-ID: <20110402101750.GD1849@garage.freebsd.pl> In-Reply-To: <86pqp53cqe.fsf@kopusha.home.net> References: <20110326003348.GQ36706@equilibrium.bsdes.net> <20110401174354.GE1289@equilibrium.bsdes.net> <86pqp53cqe.fsf@kopusha.home.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--EY/WZ/HvNxOox07X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 02, 2011 at 12:04:09AM +0300, Mikolaj Golub wrote: > For me your patch look correct. But the same issue is for read :-). Also,= to > avoid the leak I think we can just do g_destroy_bio() before "all sectors" > check. See the attached patch (had some testing). The patch looks good. Please commit. > Index: sys/geom/eli/g_eli.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/geom/eli/g_eli.c (revision 220168) > +++ sys/geom/eli/g_eli.c (working copy) > @@ -160,13 +160,13 @@ g_eli_read_done(struct bio *bp) > pbp =3D bp->bio_parent; > if (pbp->bio_error =3D=3D 0) > pbp->bio_error =3D 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 =3D pbp->bio_to->geom->softc; > if (pbp->bio_error !=3D 0) { > G_ELI_LOGREQ(0, pbp, "%s() failed", __func__); > @@ -202,6 +202,7 @@ g_eli_write_done(struct bio *bp) > if (bp->bio_error !=3D 0) > pbp->bio_error =3D bp->bio_error; > } > + g_destroy_bio(bp); > /* > * Do we have all sectors already? > */ > @@ -215,7 +216,6 @@ g_eli_write_done(struct bio *bp) > pbp->bio_error); > pbp->bio_completed =3D 0; > } > - g_destroy_bio(bp); > /* > * Write is finished, send it up. > */ --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --EY/WZ/HvNxOox07X Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk2W984ACgkQForvXbEpPzTrXQCfVJtZr2sOU63RLytIRNXjziBO fWAAni761TsmDtlrn2O44yFQSpQv1Sjj =oYkr -----END PGP SIGNATURE----- --EY/WZ/HvNxOox07X--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110402101750.GD1849>