Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Sep 2004 13:16:38 +0200
From:      Ivan Voras <ivoras@fer.hr>
To:        current@freebsd.org
Subject:   USB memory stick hotswap problems
Message-ID:  <41555396.4030009@fer.hr>

next in thread | raw e-mail | index | archive | help
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").



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