Bug 103073 - kded cause permanent disk activity after accessing media:/
Summary: kded cause permanent disk activity after accessing media:/
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: media (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR normal
Target Milestone: ---
Assignee: Kevin Ottens
URL:
Keywords:
: 107153 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-02 15:27 UTC by Dinko Belchevski
Modified: 2005-07-14 17:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
lsof | grep output (6.15 KB, application/octet-stream)
2005-04-02 21:33 UTC, Dinko Belchevski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dinko Belchevski 2005-04-02 15:27:49 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Slackware Packages
Compiler:          gcc 3.3.5 
OS:                Linux

After accessing new media:/ protocol kded Media Manager cause permanent disk activity (hdd led blink repeatedly with small pauses). Restarting kded resolve problem, but only to next media:/ access. Problem is resolved and if I manualy stop KDED Media Manager from Control Panel.
I tried to increase PollInterval from kdeglobalrc ([DirWatch] section) but nottings happens.
I had no problems with device:/ protocol.
My system is Slackware-current with gcc 3.3.5, glibc 2.3.4, kde 3.4.
Comment 1 Kevin Ottens 2005-04-02 19:59:47 UTC
Could you take a look at your /var/log/messages or /var/log/syslog
I suspect that your system is logging the cd polling.

It shouldn't, and it happens with some kernels. I'm using the 2.6.10 here and it doesn't do it anymore.
Comment 2 Dinko Belchevski 2005-04-02 21:33:33 UTC
Created attachment 10486 [details]
lsof | grep output

Thank you for response!
I cleared /var/log/messages and /var/log/syslog and then I opened media:/. Hard
disk start blinking, but no log was writed (except some iptables stuff in
syslog).
Attached file is bziped output from lsof | grep kded (as root).
I'm using the 2.6.11.
Comment 3 Kevin Ottens 2005-04-04 13:17:30 UTC
Are you sure it is writing to the disk then?
Some boxes blink as soon as there's some IDE activity (even if it's not
for writing on hard disk).
Comment 4 Dinko Belchevski 2005-04-04 21:23:11 UTC
No, I'm not.
I tried to delete ~/.kde, but problem exist in new directory too.
Same software configuration (system libraries,kde 3.4 and applications) on two others mashines work without the problem.
Maybe this is local problem, which is not related only with kde 3.4 (with kde 3.3 everything works fine).
Comment 5 iremets 2005-04-30 23:25:36 UTC
New elements about this bug:
monitoring disk activity with simple tools such as gkrellm (and "agressive" settings concerning disks) shows no "real" activity. It seems that the ide led is only blinking. It is however really annoying on my laptop since my eyes keep lookig at this behavior ...
Comment 6 Kevin Ottens 2005-07-10 18:37:41 UTC
*** Bug 107153 has been marked as a duplicate of this bug. ***
Comment 7 Manfred Knick 2005-07-11 17:12:04 UTC
Please also view

   http://bugs.gentoo.org/show_bug.cgi?id=98668

kind regards
Manfred 
Comment 8 Kevin Ottens 2005-07-14 17:20:29 UTC
SVN commit 434563 by ervin:

Add some settings to the mediamanager and the GUI counterpart in the KCM.
You can now turn off selectively the HAL backend if you dislike its behavior
and the CD polling backend which generate activity on the IDE bus, and might
fails burning on some hardware.

BUG:103082
BUG:103073



 M  +1 -1      configure.in.in  
 M  +14 -3     kcmodule/Makefile.am  
 M  +12 -1     kcmodule/main.cpp  
 M  +1 -0      kcmodule/main.h  
 A             kcmodule/managermodule.cpp   [License: LGPL]
 A             kcmodule/managermodule.h   [License: LGPL]
 A             kcmodule/managermoduleview.ui  
 M  +3 -1      libmediacommon/Makefile.am  
 A             libmediacommon/mediamanagersettings.kcfg  
 A             libmediacommon/mediamanagersettings.kcfgc  
 M  +45 -16    mediamanager/mediamanager.cpp  
 M  +4 -1      mediamanager/mediamanager.h  


--- trunk/KDE/kdebase/kioslave/media/configure.in.in #434562:434563
@@ -137,7 +137,7 @@
 
 ########### Check if media HAL backend sould be compiled
 
-AC_MSG_CHECKING(if the HAL backend for media:/ sould be compiled)
+AC_MSG_CHECKING(if the HAL backend for media:/ should be compiled)
 
 HALBACKEND=no
 if [test "x$hal" = "xFOUND"] && [test "x$dbus" = "xFOUND"] && [test "x$dbusqt" = "xFOUND"] ; then
--- trunk/KDE/kdebase/kioslave/media/kcmodule/Makefile.am #434562:434563
@@ -1,17 +1,28 @@
 INCLUDES = -I$(srcdir)/../libmediacommon $(all_includes)
 METASOURCES = AUTO
 
+CXXFLAGS=
+if include_media_linuxcdpolling
+CXXFLAGS+=-DCOMPILE_LINUXCDPOLLING
+endif
+if include_media_halbackend
+CXXFLAGS+=-DCOMPILE_HALBACKEND
+endif
+
 kde_module_LTLIBRARIES = kcm_media.la
 kcm_media_la_SOURCES = notifiermodule.cpp notifiermoduleview.ui \
                        serviceconfigdialog.cpp serviceview.ui \
-                       mimetypelistboxitem.cpp main.cpp
+                       mimetypelistboxitem.cpp \
+                       managermodule.cpp managermoduleview.ui \
+                       main.cpp
 
 kcm_media_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined
 kcm_media_la_LIBADD = ../libmediacommon/libmediacommon.la $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO)
 
+noinst_HEADERS = notifiermodule.h managermodule.h \
+                 serviceconfigdialog.h mimetypelistboxitem.h \
+                 main.h
 
-noinst_HEADERS = notifiermodule.h serviceconfigdialog.h mimetypelistboxitem.h main.h
-
 xdg_apps_DATA = media.desktop
 
 messages: rc.cpp
--- trunk/KDE/kdebase/kioslave/media/kcmodule/main.cpp #434562:434563
@@ -29,6 +29,7 @@
 #include <kgenericfactory.h>
 
 #include "notifiermodule.h"
+#include "managermodule.h"
 
 
 typedef KGenericFactory<MediaModule, QWidget> MediaFactory;
@@ -42,14 +43,21 @@
 	QTabWidget *tab = new QTabWidget( this );
 	
 	layout->addWidget( tab );
+
+
 	
 	m_notifierModule = new NotifierModule( this, "notifier" );
 	tab->addTab( m_notifierModule, i18n( "&Notifications" ) );
 	connect( m_notifierModule, SIGNAL( changed( bool ) ),
 	         this, SLOT( moduleChanged( bool ) ) );
 
+	m_managerModule = new ManagerModule( this, "manager" );
+	tab->addTab( m_managerModule, i18n( "&Advanced" ) );
+	connect( m_managerModule, SIGNAL( changed( bool ) ),
+	         this, SLOT( moduleChanged( bool ) ) );
 
-	
+
+
 	KAboutData * about = new KAboutData("kcmmedia",
 	                                    I18N_NOOP("Storage Media"),
 	                                    "0.6",
@@ -66,16 +74,19 @@
 void MediaModule::load()
 {
 	m_notifierModule->load();
+	m_managerModule->load();
 }
 
 void MediaModule::save()
 {
 	m_notifierModule->save();
+	m_managerModule->save();
 }
 
 void MediaModule::defaults()
 {
 	m_notifierModule->defaults();
+	m_managerModule->defaults();
 }
 
 void MediaModule::moduleChanged( bool state )
--- trunk/KDE/kdebase/kioslave/media/kcmodule/main.h #434562:434563
@@ -39,6 +39,7 @@
 	
 private:
 	KCModule *m_notifierModule;
+	KCModule *m_managerModule;
 };
 
 #endif
--- trunk/KDE/kdebase/kioslave/media/libmediacommon/Makefile.am #434562:434563
@@ -5,5 +5,7 @@
 libmediacommon_la_SOURCES = medium.cpp actionlistboxitem.cpp \
                             notifieraction.cpp notifierserviceaction.cpp \
                             notifiernothingaction.cpp notifieropenaction.cpp \
-                            notifiersettings.cpp
+                            notifiersettings.cpp mediamanagersettings.kcfgc
 
+kde_kcfg_DATA = mediamanagersettings.kcfg
+
--- trunk/KDE/kdebase/kioslave/media/mediamanager/mediamanager.cpp #434562:434563
@@ -27,6 +27,8 @@
 
 #include <kdirnotify_stub.h>
 
+#include "mediamanagersettings.h"
+
 #include "fstabbackend.h"
 
 #ifdef COMPILE_HALBACKEND
@@ -49,37 +51,58 @@
 	         SIGNAL(mediumStateChanged(const QString&, const QString&, bool)),
 	         SLOT(slotMediumChanged(const QString&, const QString&, bool)) );
 
-	m_backends.setAutoDelete(true);
 	QTimer::singleShot( 10, this, SLOT( loadBackends() ) );
 }
 
+MediaManager::~MediaManager()
+{
+	while ( !m_backends.isEmpty() )
+	{
+		BackendBase *b = m_backends.first();
+		m_backends.remove( b );
+		delete b;
+	}
+}
+
 void MediaManager::loadBackends()
 {
-	m_backends.clear();
+	while ( !m_backends.isEmpty() )
+	{
+		BackendBase *b = m_backends.first();
+		m_backends.remove( b );
+		delete b;
+	}
+
 	mp_removableBackend = 0L;
 
 #ifdef COMPILE_HALBACKEND
-	HALBackend* halBackend = new HALBackend(m_mediaList, this);
-	if (halBackend->InitHal())
-		m_backends.append( halBackend );
-	else
+	if ( MediaManagerSettings::self()->halBackendEnabled() )
 	{
-		delete halBackend;
-		mp_removableBackend = new RemovableBackend(m_mediaList);
-		m_backends.append( mp_removableBackend );
-#ifdef COMPILE_LINUXCDPOLLING
-		m_backends.append( new LinuxCDPolling(m_mediaList) );
-#endif //COMPILE_LINUXCDPOLLING
-		m_backends.append( new FstabBackend(m_mediaList) );
+		HALBackend* hal_backend = new HALBackend(m_mediaList, this);
+		if (hal_backend->InitHal())
+		{
+			m_backends.append( hal_backend );
+			// No need to load something else...
+			return;
+		}
+		else
+		{
+			delete hal_backend;
+		}
 	}
-#else //COMPILE_HALBACKEND
+#endif // COMPILE_HALBACKEND
+
 	mp_removableBackend = new RemovableBackend(m_mediaList);
 	m_backends.append( mp_removableBackend );
+	
 #ifdef COMPILE_LINUXCDPOLLING
-	m_backends.append( new LinuxCDPolling(m_mediaList) );
+	if ( MediaManagerSettings::self()->cdPollingEnabled() )
+	{
+		m_backends.append( new LinuxCDPolling(m_mediaList) );
+	}
 #endif //COMPILE_LINUXCDPOLLING
+
 	m_backends.append( new FstabBackend(m_mediaList) );
-#endif //COMPILE_HALBACKEND
 }
 
 
@@ -138,6 +161,12 @@
 	m_mediaList.setUserLabel(name, label);
 }
 
+ASYNC MediaManager::reloadBackends()
+{
+	MediaManagerSettings::self()->readConfig();
+	loadBackends();
+}
+
 bool MediaManager::removablePlug(const QString &devNode, const QString &label)
 {
 	if (mp_removableBackend)
--- trunk/KDE/kdebase/kioslave/media/mediamanager/mediamanager.h #434562:434563
@@ -35,6 +35,7 @@
 K_DCOP
 public:
 	MediaManager(const QCString &obj);
+	~MediaManager();
 
 k_dcop:
 	QStringList fullList();
@@ -42,6 +43,8 @@
 	QString nameForLabel(const QString &label);
 	ASYNC setUserLabel(const QString &name, const QString &label);
 
+	ASYNC reloadBackends();
+
 	// Removable media handling (for people not having HAL)
 	bool removablePlug(const QString &devNode, const QString &label);
 	bool removableUnplug(const QString &devNode);
@@ -62,7 +65,7 @@
 
 private:
 	MediaList m_mediaList;
-	QPtrList<BackendBase> m_backends;
+	QValueList<BackendBase*> m_backends;
 	RemovableBackend *mp_removableBackend;
 	MediaDirNotify m_dirNotify;
 };