From owner-freebsd-current@FreeBSD.ORG Mon Aug 25 10:25:45 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C2F4516A4BF; Mon, 25 Aug 2003 10:25:45 -0700 (PDT) Received: from melusine.cuivre.fr.eu.org (melusine.cuivre.fr.eu.org [62.212.105.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCFED43F85; Mon, 25 Aug 2003 10:25:44 -0700 (PDT) (envelope-from thomas@FreeBSD.ORG) Received: by melusine.cuivre.fr.eu.org (Postfix, from userid 1000) id 3AF6B2C3D3; Mon, 25 Aug 2003 19:25:42 +0200 (CEST) Date: Mon, 25 Aug 2003 19:25:42 +0200 From: Thomas Quinot To: Matt Message-ID: <20030825172542.GA23174@melusine.cuivre.fr.eu.org> References: <200308241328.h7ODSjwC067165@spider.deepcore.dk> <20030825014824.GA6311@melusine.cuivre.fr.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4i X-message-flag: WARNING! Using Outlook can damage your computer. cc: freebsd-current@FreeBSD.ORG cc: Soren Schmidt cc: Thomas Quinot Subject: Re: HEADS UP! ATAng committed X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Thomas Quinot List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Aug 2003 17:25:45 -0000 Le 2003-08-25, Matt écrivait : > db> trace > free_hcb(c40f1040,c03c7e40,101,c41d5800,c1528130) at free_hcb+0x2e > atapi_action(c40f1440,c41d5800,c0132b33,c41db000,c41d5800) at > atapi_action+ox56c OK, so that presumably means we're going through action_oom, and so you should have had one of the following messages on the console: printf("cannot allocate ATAPI/CAM hcb\n"); printf("cannot allocate ATAPI/CAM request\n"); printf("cannot allocate ATAPI/CAM buffer\n"); It would be interesting to know which, if any, of these messages you saw. Also, please try whether the following patch improves the situation: Index: atapi-cam.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/atapi-cam.c,v retrieving revision 1.20 diff -u -r1.20 atapi-cam.c --- atapi-cam.c 24 Aug 2003 17:48:05 -0000 1.20 +++ atapi-cam.c 25 Aug 2003 17:24:44 -0000 @@ -59,7 +59,7 @@ int lun; union ccb *ccb; int flags; -#define DOING_AUTOSENSE 1 +#define QUEUED 0x0001; char *dxfer_alloc; TAILQ_ENTRY(atapi_hcb) chain; @@ -394,7 +394,7 @@ /* scatter-gather not supported */ xpt_print_path(ccb_h->path); printf("ATAPI/CAM does not support scatter-gather yet!\n"); - break; + goto action_invalid; } if ((hcb = allocate_hcb(softc, unit, bus, ccb)) == NULL) { @@ -464,8 +464,8 @@ if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_IN && (len & 1)) { /* ATA always transfers an even number of bytes */ - if (!(buf = hcb->dxfer_alloc = malloc(++len, M_ATACAM, - M_NOWAIT | M_ZERO))) + if ((buf = hcb->dxfer_alloc = malloc(++len, M_ATACAM, + M_NOWAIT | M_ZERO)) == NULL) printf("cannot allocate ATAPI/CAM buffer\n"); goto action_oom; } @@ -494,6 +494,7 @@ } TAILQ_INSERT_TAIL(&softc->pending_hcbs, hcb, chain); + hcb->flags |= QUEUED; ata_queue_request(request); return; @@ -519,9 +520,13 @@ return; action_invalid: - ccb_h->status = CAM_REQ_INVALID; - xpt_done(ccb); - return; + if (request != NULL) + ata_free_request(request); + if (hcb != NULL) + free_hcb(hcb); + ccb_h->status = CAM_REQ_INVALID; + xpt_done(ccb); + return; } static void @@ -686,7 +691,8 @@ static void free_hcb(struct atapi_hcb *hcb) { - TAILQ_REMOVE(&hcb->softc->pending_hcbs, hcb, chain); + if ((hcb->flags & QUEUED) != 0) + TAILQ_REMOVE(&hcb->softc->pending_hcbs, hcb, chain); if (hcb->dxfer_alloc != NULL) free(hcb->dxfer_alloc, M_ATACAM); free(hcb, M_ATACAM); -- Thomas.Quinot@Cuivre.FR.EU.ORG