From owner-freebsd-hackers Thu Oct 24 23:23:09 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id XAA25364 for hackers-outgoing; Thu, 24 Oct 1996 23:23:09 -0700 (PDT) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id XAA25347 for ; Thu, 24 Oct 1996 23:23:04 -0700 (PDT) Received: from mail.crl.com (mail.crl.com [165.113.1.22]) by who.cdrom.com (8.7.5/8.6.11) with SMTP id XAA15302 for ; Thu, 24 Oct 1996 23:11:33 -0700 (PDT) Received: from luoqi.watermarkgroup.com (ppp-1.ts-1.ptn.idt.net) by mail.crl.com with SMTP id AA17707 (5.65c/IDA-1.5 for ); Thu, 24 Oct 1996 23:12:14 -0700 Received: from sabrina (localhost [127.0.0.1]) by luoqi.watermarkgroup.com (8.7.5/8.6.12) with SMTP id CAA00353 for ; Fri, 25 Oct 1996 02:10:23 -0400 (EDT) Message-Id: <327059CE.41C67EA6@watermarkgroup.com> Date: Fri, 25 Oct 1996 02:10:22 -0400 From: Luoqi Chen X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.1.5-RELEASE i386) Mime-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: ATAPI bug fix Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk A process may hang when a CD is inserted during an open operation (90% of the time if I try to switch CD when xcdplayer is running). In function atapi_start(), the request may have already failed before wdstart returns (e.g. timeout waiting for DRQ because of insertion of the CD). The fix is sleep only if the request is still on the queue. The following diff is for 2.1.5R. -lq *** atapi.c.orig Fri Oct 25 00:28:58 1996 --- atapi.c Fri Oct 25 01:55:03 1996 *************** *** 788,794 **** ac->cmd[13], ac->cmd[14], ac->cmd[15], count); atapi_enqueue (ata, ac); wdstart (ata->ctrlr); ! tsleep ((caddr_t)ac, PRIBIO, "atareq", 0); result = ac->result; atapi_free (ata, ac); --- 788,795 ---- ac->cmd[13], ac->cmd[14], ac->cmd[15], count); atapi_enqueue (ata, ac); wdstart (ata->ctrlr); ! if (ac == ata->queue) ! tsleep ((caddr_t)ac, PRIBIO, "atareq", 0); result = ac->result; atapi_free (ata, ac);