Date: Mon, 28 Nov 2005 23:00:56 -0500 From: Michael Butler <imb@protected-networks.net> To: stable@freebsd.org Cc: =?ISO-8859-1?Q?S=F8ren_Schmidt?= <sos@freebsd.org> Subject: Re: ata (raid) patches Message-ID: <438BD278.30006@protected-networks.net> In-Reply-To: <438A116C.3010803@protected-networks.net> References: <438A116C.3010803@protected-networks.net>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------080701040305020803060205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I wrote: | For those game enough to try the results of my handiwork ;-), enclosed | is a patch against the files in /usr/src/sys/dev/ata for RELENG_6 (and | possibly others) with the following objectives: | | 1) the ata-raid driver currently leaks ata_composite and ata_request | structures into "neverland" in a mirrored configuration. This can be | observed using "sysctl -a | grep ^ata_" and noting the increasing | "in-use" count as time goes on. Eventually, this causes the kernel to | run out of memory. This is fixed by tracking the request counts on each | composite request. ~ [ .. ] | As usual, this patch comes with no warranty ... it works for me. "If it | breaks your system, you own all the pieces". | | I recommend you back up your system before testing, This is just the composite/request leak patch on it's own, Michael -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) iD8DBQFDi9J3iJykeV6HPMURAvENAJ4v9p/HjHLQ+iJ+EH23+z9ZiTbXyACeOhNA ux0UiWyGNNKu4rrPl12GP+4= =NC/r -----END PGP SIGNATURE----- --------------080701040305020803060205 Content-Type: text/plain; name="ata-raid-patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ata-raid-patch" *** /usr/src/sys/dev/ata/ata-all.h.orig Sun Nov 27 14:17:57 2005 --- /usr/src/sys/dev/ata/ata-all.h Sun Nov 27 14:22:05 2005 *************** *** 331,336 **** --- 331,337 ---- u_int32_t wr_depend; /* write depends on subdisks */ u_int32_t wr_done; /* done write subdisks */ struct ata_request *request[32]; /* size must match maps above */ + long count; /* count required of this composite */ caddr_t data_1; caddr_t data_2; }; *** ata-raid.c.orig Mon Nov 28 18:02:01 2005 --- ata-raid.c Mon Nov 28 22:52:53 2005 *************** *** 410,415 **** --- 410,416 ---- mtx_init(&composite->lock, "ATA PseudoRAID rebuild lock", NULL, MTX_DEF); + composite->count = request->bytecount; composite->rd_needed |= (1 << drv); composite->wr_depend |= (1 << drv); composite->wr_needed |= (1 << this); *************** *** 468,473 **** --- 469,475 ---- mtx_init(&composite->lock, "ATA PseudoRAID mirror lock", NULL, MTX_DEF); + composite->count = request->bytecount; composite->wr_needed |= (1 << drv); composite->wr_needed |= (1 << this); composite->request[drv] = request; *************** *** 607,613 **** /* good data, update how far we've gotten */ else { bp->bio_resid -= request->donecount; ! if (bp->bio_resid == 0) { if (composite->wr_done & (1 << mirror)) finished = 1; } --- 609,616 ---- /* good data, update how far we've gotten */ else { bp->bio_resid -= request->donecount; ! composite->count -= request->donecount; ! if (composite->count == 0) { if (composite->wr_done & (1 << mirror)) finished = 1; } *************** *** 621,627 **** printf("DOH! rebuild failed\n"); /* XXX SOS */ rdp->rebuild_lba = blk; } ! if (bp->bio_resid == 0) finished = 1; } } --- 624,630 ---- printf("DOH! rebuild failed\n"); /* XXX SOS */ rdp->rebuild_lba = blk; } ! if (composite->count == 0) finished = 1; } } *************** *** 658,667 **** } bp->bio_resid -= composite->request[mirror]->donecount; } ! else bp->bio_resid -= request->donecount; ! if (bp->bio_resid == 0) finished = 1; } mtx_unlock(&composite->lock); --- 661,674 ---- } bp->bio_resid -= composite->request[mirror]->donecount; + composite->count -= + composite->request[mirror]->donecount; } ! else { bp->bio_resid -= request->donecount; ! composite->count -= request->donecount; ! } ! if (composite->count == 0) finished = 1; } mtx_unlock(&composite->lock); *************** *** 723,729 **** rdp->status &= ~AR_S_REBUILDING; ata_raid_config_changed(rdp, 1); } ! biodone(bp); } if (composite) { --- 730,738 ---- rdp->status &= ~AR_S_REBUILDING; ata_raid_config_changed(rdp, 1); } ! /* cover the case of a series of composites which are only partly complete */ ! if (bp->bio_resid == 0) ! biodone(bp); } if (composite) { --------------080701040305020803060205--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?438BD278.30006>