[tracker/tracker-0.8] Fixes GB#621183: When mounting volume 2nd time, inotify watches don't work any more



commit 774c185b954e7696082fa42e6bd5ffeb48aff652
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Jun 11 12:07:49 2010 +0200

    Fixes GB#621183: When mounting volume 2nd time, inotify watches don't work any more
    
    * src/libtracker-miner/tracker-miner-fs.c: Make sure all monitors are removed
    when a directory is no longer watched.
    
    * src/miners/fs/tracker-miner-files.c: Make sure directory is no longer
    watched when unmounting (in case we didn't get a pre-unmount signal)

 src/libtracker-miner/tracker-miner-fs.c |    3 +++
 src/miners/fs/tracker-miner-files.c     |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index dfc48c8..fb65848 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -3180,6 +3180,9 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
 		pool = pool->next;
 	}
 
+	/* Remove all monitors */
+	tracker_monitor_remove_recursively (fs->private->monitor, file);
+
 	return return_val;
 }
 
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 0d572b6..2212645 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -818,13 +818,22 @@ mount_point_removed_cb (TrackerStorage *storage,
 {
 	TrackerMinerFiles *miner = user_data;
 	gchar *urn;
+	GFile *mount_point_file;
 
 	g_debug ("Removing mount point '%s'", mount_point);
 
 	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
+	mount_point_file = g_file_new_for_path (mount_point);
 
+	/* Set mount point status in tracker-store */
 	set_up_mount_point (miner, urn, mount_point, FALSE, NULL);
+
+	/* Tell TrackerMinerFS to skip monitoring everything under the mount
+	 *  point (in case there was no pre-unmount notification) */
+	tracker_miner_fs_directory_remove (TRACKER_MINER_FS (miner), mount_point_file);
+
 	g_free (urn);
+	g_object_unref (mount_point_file);
 }
 
 static void
@@ -1086,10 +1095,14 @@ mount_pre_unmount_cb (GVolumeMonitor    *volume_monitor,
                       TrackerMinerFiles *mf)
 {
 	GFile *mount_root;
+	gchar *uri;
 
 	mount_root = g_mount_get_root (mount);
+	uri = g_file_get_uri (mount_root);
+	g_message ("Pre-unmount requested for '%s'", uri);
 	tracker_miner_fs_directory_remove (TRACKER_MINER_FS (mf), mount_root);
 	g_object_unref (mount_root);
+	g_free (uri);
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]