Bug 65692

Summary: KDirWatch problem with Autofs
Product: [Unmaintained] kio Reporter: Karai Csaba <ckarai>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: adawit
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Karai Csaba 2003-10-08 10:39:15 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    SuSE RPMs

The watcher causes 100% CPU if there is no floppy in the autofs drive.

Reproducing the bug with Konqueror (floppy configured as an autofs drive):
1. Step into the autofs directory ( ex. file:/mnt/auto )
--> dirwatch is started on it
2. Get out the floppy from the floppy drive
3. Continue writing the URL (file:/mnt/auto) with /floppy/
--> after pressing the second /, floppy drive became noisy CPU load will be 100% 
--> as it tries to read the empty device infinitely. 
4. Insert a floppy into the drive -> the infinite dirwatch stops.

Further investigation:
At trying to mount an autofs drive autofs creates a non-existing directory called floppy
even if there is no floppy in the drive. KDirWatch notices this directory and after that
tries checking its existence which lead infinite mount tries and 100% CPU usage.

Thanks,
    Csaba
Comment 1 Dennis Noordsij 2004-05-24 09:46:47 UTC
Currently KDirWatch will monitor autofs directories, causing autofs to remount the device continously (say a USB stick where you could otherwise wait 2 seconds for autofs to unmount it, then remove it).

The ideal behaviour of KDirWatch would be to NOT monitor autofs directories, but if it is possible to find out when autofs has mounted or unmounted a certain device, the contents of that device may be monitored.

For example, 
Do not monitor /var/autofs/removable/
I insert a USB stick, the hotplug script creates a .desktop entry.
If I access the device, autofs mounts it, and then KDirWatch can monitor the contents, i.e. /var/autofs/removable/usbstick/ - until autofs unmounts it (a few seconds after no activity), then it should stop monitoring.

It can then be accessed again (same steps are repeated), or removed (since it is unmounted), and hotplug will then remove the .desktop entry.

In summary:
The main problem is that KDirWatch should not try to monitor /var/autofs/removable or /var/autofs/removable/usbstick because the device keeps getting mounted, making it dangerous to just take it out.

Comment 2 Dennis Noordsij 2004-05-24 13:39:07 UTC
(More a comment for people playing with hotplug/autofs/kde and running into the KDirWatch problem).

The quickest non-intrusive way to deal with this, is to use a /dev symlink to the autofs directory structure. KDirWatch does not watch /dev entries.

ln -s /var/autofs/removable/usbstick /dev/autofs/usbstick

Have a hotplug script create a .desktop entry pointing to /dev/autofs/usbstick whenever the stick is plugged in (regardless of wether it is mounted), and remove it when unplugged. 

Because the /dev/autofs/usbstick is not monitored autofs can unmount the stick after the timeout and it can be safely unplugged without any special commands or actions (also mount with 'sync' to be on the safe side).

Same goes for CD's, floppies, etc.
Comment 3 Dawit Alemayehu 2013-06-06 04:36:41 UTC
KDE 3 is no longer maintained. Feel free to reopen if applicable to the latest version of KDE 4.