From owner-freebsd-stable@FreeBSD.ORG Tue Nov 29 04:01:21 2005 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC76716A422; Tue, 29 Nov 2005 04:01:21 +0000 (GMT) (envelope-from imb@protected-networks.net) Received: from aaron.protected-networks.net (aaron.protected-networks.net [202.12.127.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 082C943D58; Tue, 29 Nov 2005 04:01:17 +0000 (GMT) (envelope-from imb@protected-networks.net) Received: from localhost (localhost [127.0.0.1]) by aaron.protected-networks.net (Postfix) with ESMTP id 7A379C1FA; Mon, 28 Nov 2005 23:01:14 -0500 (EST) Received: from aaron.protected-networks.net (localhost [127.0.0.1]) by aaron.protected-networks.net (Postfix) with ESMTP id B02CDC26F; Mon, 28 Nov 2005 23:01:06 -0500 (EST) Authentication-Results: aaron.protected-networks.net from=imb@protected-networks.net; domainkey=pass Received: from aaron.protected-networks.net (localhost [127.0.0.1]) by aaron.protected-networks.net (Postfix) with ESMTP id 5EC94C262; Mon, 28 Nov 2005 23:01:06 -0500 (EST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=200509; d=protected-networks.net; b=TI6trq37TZfd7ayJRNWTIgp8AIYaCupkkvQLxg92a3w8XUAH6WnSAdcxjhfrjlD5zvKZXZZmtbF/30pkMcdUdJ5vn0yqKMmaj70DdfM+vXlQsZZ2kENqiabYMetw7lxD; Received: from [10.12.211.45] (usstls-23.savvis.net [64.242.52.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "imb@protected-networks.net", Issuer "Protected Networks Certificate Authority" (verified OK)) (Authenticated sender: imb@protected-networks.net) by aaron.protected-networks.net (Postfix) with ESMTP id 8EB68C1A3; Mon, 28 Nov 2005 23:01:05 -0500 (EST) Message-ID: <438BD278.30006@protected-networks.net> Date: Mon, 28 Nov 2005 23:00:56 -0500 From: Michael Butler User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: stable@freebsd.org References: <438A116C.3010803@protected-networks.net> In-Reply-To: <438A116C.3010803@protected-networks.net> X-Enigmail-Version: 0.93.0.0 OpenPGP: id=5E873CC5 Content-Type: multipart/mixed; boundary="------------080701040305020803060205" Cc: =?ISO-8859-1?Q?S=F8ren_Schmidt?= Subject: Re: ata (raid) patches X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2005 04:01:21 -0000 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--