Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2002 11:16:49 -0700 (PDT)
From:      "Igor A. Goussarov" <igusarov@akella.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/38923: Incorrect device use count prevents door locking
Message-ID:  <200206051816.g55IGn42062684@www.freebsd.org>

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

>Number:         38923
>Category:       kern
>Synopsis:       Incorrect device use count prevents door locking
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 05 11:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Igor A. Goussarov
>Release:        i386-FreeBSD-4.4-RELEASE
>Organization:
Akella Corp.
>Environment:
FreeBSD gate.studio1001.akella.ru 4.4-RELEASE FreeBSD 4.4-RELEASE #6: Wed Jun  5 21:47:22 MSD 2002     igusarov@gate.studio1001.akella.ru:/usr/src/sys/compile/GATE_006  i386

>Description:
I have an Iomega ZIP drive, which I wish to mount and use. The problem is that the drive is not locked when it is mounted. Back in FreeBSD 3.3, when I was using wfd device, the disk cannot be ejected while it was in use.
Now, in 4.4, the disk is not locked in the drive.
I've tracked the problem down to /usr/src/sys/dev/ata/atapi-fd.c file. The function afdopen is supposed to lock the drive if the count_dev for the device being opened indicates that this is the first use of the device.
And it _does_ lock the drive if I were to open it as /dev/afd0. But it _does_not_ lock the device if I try to open it as /dev/afd0s4 (which is a-must for msdos-formatted zip media).
The problem is that count_dev return 0 instead of 1 in the latter case. My kernel debugging capabilities are limited so I can't examine the problem any further...
>How-To-Repeat:
1. Install an ATAPI ZIP drive (I use Iomega 100Mb)
2. cd /dev; ./MAKEDEV afd0  (or whatever unit number it is)
3. Insert any zip diskette into the drive. Not necessarily formatted.
4. From midnight commander try to "view" the contents of /dev/afd0 file by pressing F3. While the view is active, you cannot eject the disk by pressing eject button on the drive.
5. Close the view, go to the /dev/afd0s4 special file and try to "view" it. Now you can eject the disk by pressing the eject button even thought it is in use!

The same behaviour remains if you were to mount msdos filesystem from this disk. I've used midc's "view" feature just to simulate file usage.
>Fix:
I don't know one.
>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?200206051816.g55IGn42062684>