Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Aug 2000 19:18:46 -0700 (PDT)
From:      dcschooley@ieee.org
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/20933: ATAPI ZIP drive allows mounted disks to be ejected
Message-ID:  <20000830021846.7B56D37B424@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000830021846.7B56D37B424>