Re: Syquest drive trouble: Allows ejects.

mark (mlord@bnr.ca)
Mon, 22 Apr 1996 10:12:00 -0400


In message "Re: Syquest drive trouble: Allows ejects.",
'grant@gear.torque.net' writes:

>> I've got a Syquest EZ-Drive as /dev/hdc. Under Linux, ejection can be
>> stopped in software. So, while a filesystem is mounted I can press the
>> button and the eject will be deferred till I unmount it.
>
>Funny you should mention this !
>
>> However, I have noticed that I can also eject the disk under these
>> conditions:
>> mount -t ext2 /dev/hdc1 /sy
>> dd if=/dev/hdc1 of=/dev/null count=1
>> Now the eject button causes the drive to spin down even though
>> /dev/hdc1 is still mounted.
>
>There was another problem with removable media in both the ide and scsi
>disk drivers. When the device is closed with ide_release or sd_release,
>the driver doesn't wait for the sync to complete before unlocking the
>door. Under some circumstances, this can result in the disk being ejected
>before writing has completed. Not good.
>
>I was working on a patch for that problem when I noticed that the ide
>driver does not maintain an access count, as the scsi driver does. I

Sure it does.. but maybe the door-lock code does not use it..

>wondered whether that was also a problem, and now you have confirmed it -
>one day later :-)
>
>> I think that some sort of checking needs to be added in
>> drivers/block/ide.c:ide_open() and :ide_release(), perhaps a counter that
>> is incremented and then decremented. However, I haven't looked at the code
>> too closely, and I'm not sure exactly when ide_release() gets called.

I don't have the code handy here, but there is already an access count
in there somewhere. Perhaps the problem is that the two operations
are accessing difference minor devices ?? I believe the existing access
counts are separate for each minor device (partition), and there is not one
"master" count for the raw drive (minor==0).

Try something along those lines and let me know what you find/do.

Thanks for your help,

-ml