[gvfs] trash: do not care about mount points without read access



commit 60f96a4cdd942fcb52e470cbb1437f6eafdc3f04
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Sep 25 17:26:51 2014 +0200

    trash: do not care about mount points without read access
    
    The g_file_monitor_directory polls the directory every 2 seconds if
    we try to monitor mount points without read access. It prevents autofs
    mounts from being expired and causes high system load. Don't watch
    mount points without read access at all to fix the problem.
    
    Based on the patch by Scott Mayhew.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737371

 daemon/trashlib/trashwatcher.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/daemon/trashlib/trashwatcher.c b/daemon/trashlib/trashwatcher.c
index 9661ce4..d681733 100644
--- a/daemon/trashlib/trashwatcher.c
+++ b/daemon/trashlib/trashwatcher.c
@@ -66,6 +66,15 @@ decide_watch_type (GUnixMountEntry *mount,
                    gboolean         is_home_trash)
 {
   const gchar *fs_type;
+  const gchar *mount_path;
+
+  mount_path = g_unix_mount_get_mount_path (mount);
+
+  /* Do not care about mount points without read access to avoid polling, see:
+   * https://bugzilla.gnome.org/show_bug.cgi?id=522314
+   */
+  if (access (mount_path, R_OK) != 0)
+    return TRASH_WATCHER_NO_WATCH;
 
   fs_type = g_unix_mount_get_fs_type (mount);
 


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