From owner-freebsd-bugs Tue Aug 29 19:20: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D6ED537B43F for ; Tue, 29 Aug 2000 19:20:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id TAA11779; Tue, 29 Aug 2000 19:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 7B56D37B424; Tue, 29 Aug 2000 19:18:46 -0700 (PDT) Message-Id: <20000830021846.7B56D37B424@hub.freebsd.org> Date: Tue, 29 Aug 2000 19:18:46 -0700 (PDT) From: dcschooley@ieee.org To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/20933: ATAPI ZIP drive allows mounted disks to be ejected Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 20933 >Category: kern >Synopsis: ATAPI ZIP drive allows mounted disks to be ejected >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 29 19:20:02 PDT 2000 >Closed-Date: >Last-Modified: >Originator: David Schooley >Release: 4.1-STABLE, cvsup'ed on 8/28/2000 >Organization: N/A >Environment: FreeBSD geek-machine 4.1-STABLE FreeBSD 4.1-STABLE #1: Tue Aug 29 06:57:52 CDT 2000 dcs@geek-machine:/usr/src/sys/compile/WHEEL i386 >Description: As implemented in the current atapi-fd driver code, an ATAPI ZIP drive allows mounted disks to be ejected. This can cause an unrecoverable I/O error if the disk is reinserted, which requires the machine to be rebooted. The existing code uses the correct ATA calls to lock the drive, but the function is only called if count_dev() returns 1. During my testing, count_dev() only returned 0 for the ZIP drive, but it did return 1 for the CDROM. >How-To-Repeat: 1. Mount a ufs formatted zip disk. 2. Eject the disk. 3. Reinsert the disk and attempt to unmount it. >Fix: The following patch to sys/dev/ata/atapi-fd.c fixes the problem by eliminating the call to count_dev(). The count_dev() function call appears to be unnecessary. *** atapi-fd.c.orig Tue Aug 29 06:55:26 2000 --- atapi-fd.c Tue Aug 29 06:57:20 2000 *************** *** 224,231 **** atapi_test_ready(fdp->atp); ! if (count_dev(dev) == 1) ! afd_prevent_allow(fdp, 1); if (afd_sense(fdp)) printf("afd%d: sense media type failed\n", fdp->lun); --- 224,230 ---- atapi_test_ready(fdp->atp); ! afd_prevent_allow(fdp, 1); if (afd_sense(fdp)) printf("afd%d: sense media type failed\n", fdp->lun); *************** *** 247,254 **** { struct afd_softc *fdp = dev->si_drv1; ! if (count_dev(dev) == 1) ! afd_prevent_allow(fdp, 0); return 0; } --- 246,252 ---- { struct afd_softc *fdp = dev->si_drv1; ! afd_prevent_allow(fdp, 0); return 0; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message