USB Media card - works at boot-up, removal works, re-insert doesn't

David Zeuthen david at fubar.dk
Tue Sep 21 14:08:24 PDT 2004


On Tue, 2004-09-21 at 21:29 +0100, Luke Kenneth Casson Leighton wrote:
> hi david,
> 
> okay i tracked down a bit further, i think i outlined a bit towards the
> end of the original message:
> 

This is quite interesting,

> * umount -l /media/usbdisk7 is being done but konqueror still has
>   directory handles open on it.
> 
> * therefore ioctl("/dev/sdc", BLKRRPART) returns an error "Device Busy".
> 
> * therefore no notifications go to the child volumes.
> 
> i "solved" the problem by doing this drastic and vicious assault on
> KDE programs:
> 
> 	system("lsof %s | cut -d' ' -f2 | sort | uniq | xargs kill -TERM",
> 	       mount_point);
> 
> when that is done from HAL just before the unmount -l, the problem goes
> away.
> 

Heh :-)

> *beam* :)
> 
> ... of course, i wouldn't dream of suggesting to anyone that this
> technique actually be used in a production environment, but it _does_
> work.
> 
> *lol*.
> 
> but seriously, the problems are caused, i believe, by KDE's kio_kfile
> plugin, which does "directory notify" requests.
> 
> i'm endeavouring to track down whether disabling "dir notify" solves the
> problem of konqueror keeping directory handles open.
> 

To me, it seems like a severe kernel bug if a userspace process,
*especially* if it's unprivileged, can keep the kernel from emitting
hotplug remove events when a device is physically detached. It would be
interesting to create a minimal program to reproduce this.

Thanks,
David




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



More information about the Hal mailing list