A minor problem w/ access to my flash drive

Alexey Morozov alex-hp at idisys.iae.nsk.su
Mon Jan 24 08:48:39 PST 2005


David Zeuthen writes:

>>> Hal checks every second (or every 2, dunno exactly) if there is a media change
>>> on the driver, this could be the reason your seeing that behaviour.  On my
>>> usbstick is see the light flash everytime hal polls :) 
>>>      
>>>
>
>It shouldn't blink when it's mounted.
>  
>
No, it keeps /shining/ even after mount. Another flash I've tried 
recently (probably a bit more modern?) blinks every two seconds or about 
(haven't tried to mount it).

>>but I never heard that a devices could be unplugged w/o proper 
>>notification...
>>    
>>
>USB device removal != media removal;
>
For my good old flash drive? I guess you're kidding ;-)

>you definitely have to poll, see the thread with the subject "removable media
>revalidation - udev  vs. devfs or static /dev" on linux-hotplug-devel
>about a year ago for some more discussion.
>  
>
Yes, I see it now ;-), thank you. What makes me smiling is that the 
entire thread was initiated by Andrew Borzenkov, the author of 
supermoung-ng kernel patch (adapted in Mandrake and Con Kolivas 
'desktop' patchset) ;-). He also got used to 'automagic behaviour' too much.

But the problem he discusse(d,s) is a bit different from my one. I don't 
speak about every hotpluggable 'seen-as-SCSI' device on Earth. My need 
is rather humble and small ;-). And this need doesn't require media 
poll, just because media == device (for which we do have exact 
notifications).

BTW the current kernel behaviour for devices like those being discussed 
in that thread is far from ideal. I was reported a bug (initially on 
udev, but later it was moved to hotplug bugs) about ide-cs deficiency: 
every access to the device working via ide-cs causes immediate remove 
and add hotplug events what effectively causes computer freeze when 
using [advanced] hotplug or udev scripts to determine device properties.

>>Is there a way to change this behaviour for this particular type of 
>>devices w/o becoming the real HAL hacker? And again this behaviour is 
>>device-specific, I just was told that another flash on another computer 
>>doesn't behave that way. Unfortunately this computer is 3K km's far 
>>away, so I can't change the computer/flash drive combination quickly ;-)
>>
>>    
>>
>
>See the .fdi file Poznar posted later in this thread.
>  
>
Yes, thank you I have seen them (haven't tried though...)

>>> The right way is to unmount the driver before pulling it out. When the umount
>>> is finished the data should be safely on the drive. 
>>>      
>>>
>>I'm sorry, but this way sucks. 
>>    
>>
>
>You have to unmount, sorry, it's unsafe to just removing the device
>backing a mounted file system. While HAL can cope this with (as far
>  
>
Well, you know, I'm familiar w/ all these 'magic unix spells' for a 
well, long enough time ;-). I even remember those broken FreeBSD kernel 
releases which paniced (not sure I spelled it correctly ;-)) after one 
pulled out a mounted diskette. But actually last, well, ~3-4 years linux 
removable devices 'do things right' for me, and this is quite handy :-).

>as the kernel can) by playing all sorts of lazy unmount tricks it's
>still not safe in many ways. If you google around, you'll find the
>same comments about Windows and Mac OS X - the former OS decided
>to remove the modal "unsafe device removal" dialog, while the latter
>does put it up.
>  
>
Windows XP also does the same way. But well, that's the point where 
Linux wins ;-).

>>Not only because I have to stop all 
>>programs being accessing the device even for read only (including those 
>>running in another user session), but also because I have to explain all 
>>this to my family which have already got used to, hmm, carelessly pull 
>>out all existing removeable devices, from diskettes to still camera. And 
>>this works so far... So I'd like to heard how to fix HAL rather than to 
>>fix ourselves :-)
>>    
>>
>
>Help fix the programs keeping open fd's on a file system instead.
>  
>
Sure? I guess it will be the fight against windmills. Some of them (like 
Midnight Commander or other file managers) simply keep open handles on 
directories being accessed or files being viewed. I doubt I should 'fix' 
them :-). What would be more useful is wide FAM adoption but actually 
it's a too long and boring road to run on :-)

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list