[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 37780] Unable to unmount device, because of Konqi & libfam
From:       David Faure <faure () kde ! org>
Date:       2005-02-10 21:21:57
Message-ID: 20050210212157.16383.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=37780         




------- Additional Comments From faure kde org  2005-02-10 22:21 -------
CVS commit by faure: 

Yet another fix for #37780 (unable to unmount device): don't keep a watch on /mnt,
it makes FAM keep hand on /mnt/cdrom, and then we can't unmount it.
Thanks to Germain Garand for solving the puzzle.
I don't dare closing the bug yet, but things seem to work well here. Please test.
CCBUG: 37780


  M +23 -4     kdirlister.cpp   1.183


--- kdelibs/kio/kio/kdirlister.cpp  #1.182:1.183
 @ -478,9 +478,28  @ void KDirListerCache::forgetDirs( KDirLi
         itemsCached.insert( urlStr, item ); // TODO: may return false!!
 
-        // watch cached directories if not manually mounted, otherwise set to "dirty"
-        if ( !KIO::manually_mounted( item->url.directory( false ) + item->url.fileName() ) )
-          item->incAutoUpdate();
+        // Should we forget the dir for good, or keep a watch on it?
+        // Generally keep a watch, except when it would prevent
+        // unmounting a removable device (#37780)
+        const bool isLocal = item->url.isLocalFile();
+        const bool isManuallyMounted = isLocal && KIO::manually_mounted( item->url.path() );
+        bool containsManuallyMounted = false;
+        if ( !isManuallyMounted && item->lstItems && isLocal ) {
+          // Look for a manually-mounted directory inside
+          // If there's one, we can't keep a watch either, FAM would prevent unmounting the CDROM
+          // I hope this isn't too slow (manually_mounted caches the last device so most
+          // of the time this is just a stat per subdir)
+          KFileItemListIterator kit( *item->lstItems );
+          for ( ; kit.current() && !containsManuallyMounted; ++kit )
+            if ( (*kit)->isDir() && KIO::manually_mounted( (*kit)->url().path() ) )
+              containsManuallyMounted = true;
+        }
+        if ( isManuallyMounted || containsManuallyMounted ) {
+          kdDebug(7004) << "Not adding a watch on " << item->url << " because it " <<
+            ( isManuallyMounted ? "is manually mounted" : "contains a manually mounted subdir" )
+                        << endl;
+          item->complete = false; // set to "dirty"
+        }
         else
-          item->complete = false;
+          item->incAutoUpdate(); // keep watch
       }
       else
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic