USB memory stick hotswap problems

From: Ivan Voras <ivoras_at_fer.hr>
Date: Sat, 25 Sep 2004 13:16:38 +0200
What is the expected behavour when umounting USB drives which have 
already been unplugged? :)
I'm sure I'm not the only one who often forgets to umount these thingies 
when leaving the site I'm working at the moment, so it should probably 
be something other than what I always encounter (BETA5):

a) "You can't". Whatever I do, either umount gets "stuck" (even with -f) 
and does nothing (cpu is not used, so it's waiting for something), or it 
just exits with "device not configured".
b) Kernel panic. This happens after using the drive for a long time, and 
umounting it some time later (even several hours later when the drive is 
no longer available at the site).
c) A curious behaviour: umount -f works (probably because nothing has 
been written to the drive), but after re-plugging the drive, I have 
*two* /dev/da0 and /dev/da0s1 devices, and the system refuses to remount 
the filesystem ("device not configured"):

crw-r-----  1 root    operator    4,  25   Aug 25 12:46 da0
crw-r-----  1 root    operator    4,  25   Aug 25 12:46 da0
crw-r-----  1 root    operator    4,  26   Aug 25 12:46 da0s1
crw-r-----  1 root    operator    4,  26   Aug 25 12:46 da0s1

Also, I can 100% reliably panic the system when these entries are added 
to the /etc/devd.conf and the drive is *plugged in*:

attach 100 {
         device-name "da0";
         action "mount /mnt/flash";
};
detach 100 {
         device-name "da0";
         action "umount -f /mnt/flash";
};

(I modelled these on the "ukbd0" example. Using "umass0" for device name 
  did nothing).

Any ideas how to solve or circumevent these problems? (Aside from "don't 
do that").
Received on Sat Sep 25 2004 - 09:17:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:13 UTC