summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2018-06-15 14:29:30 +0200
committerOndrej Holy <oholy@redhat.com>2018-08-02 13:14:10 +0200
commit3edc50498f6e51376789b7a062a1f9efcf40f554 (patch)
tree0873fd76384640ba49ab5dae7479635491f0cccc
parent3126f73c80dfc7d6c9a7d70e1b5772a1a8c98744 (diff)
downloadglib-wip/oholy/nfs-poll-monitor.tar.gz
glocalfilemonitor: Fallback to poll file monitor for NFSwip/oholy/nfs-poll-monitor
GLib currently tries to use FAM volume monitor for monitoring files within home on NFS. If FAM support is not available, it fallbacks by default to GInotifyFileMonitor. I think we should fallback to GPollFileMonitor instead, because inotify is not reliable on NFS, which may cause issues for dconf. With this patch, it should be safe to not build libgiofam and still be sure that dconf works properly if home is mounted on NFS. I think this might be a first step to remove FAM support from GLib completely, because gamin is buggy and dead for several years already. Gamin just polls files on NFS anyway. This change applies on files only, because GPollFileMonitor seems doesn't support dirs, however it should be enough for dconf. The other drawback is that one can't set poll timeout currently. Just a note that this can still be overwritten by GIO_USE_FILE_MONITOR.
-rw-r--r--gio/glocalfilemonitor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gio/glocalfilemonitor.c b/gio/glocalfilemonitor.c
index c19da3ba8..00c3f2489 100644
--- a/gio/glocalfilemonitor.c
+++ b/gio/glocalfilemonitor.c
@@ -832,6 +832,7 @@ static void g_local_file_monitor_class_init (GLocalFileMonitorClass *class)
static GLocalFileMonitor *
g_local_file_monitor_new (gboolean is_remote_fs,
+ gboolean is_directory,
GError **error)
{
GType type = G_TYPE_INVALID;
@@ -841,7 +842,8 @@ g_local_file_monitor_new (gboolean is_remote_fs,
"GIO_USE_FILE_MONITOR",
G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported));
- if (type == G_TYPE_INVALID)
+ /* Fallback rather to poll file monitor for remote files, see gfile.c. */
+ if (type == G_TYPE_INVALID && (!is_remote_fs || is_directory))
type = _g_io_module_get_default_type (G_LOCAL_FILE_MONITOR_EXTENSION_POINT_NAME,
"GIO_USE_FILE_MONITOR",
G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported));
@@ -867,7 +869,7 @@ g_local_file_monitor_new_for_path (const gchar *pathname,
is_remote_fs = g_local_file_is_remote (pathname);
- monitor = g_local_file_monitor_new (is_remote_fs, error);
+ monitor = g_local_file_monitor_new (is_remote_fs, is_directory, error);
if (monitor)
g_local_file_monitor_start (monitor, pathname, is_directory, flags, g_main_context_get_thread_default ());
@@ -888,7 +890,7 @@ g_local_file_monitor_new_in_worker (const gchar *pathname,
is_remote_fs = g_local_file_is_remote (pathname);
- monitor = g_local_file_monitor_new (is_remote_fs, error);
+ monitor = g_local_file_monitor_new (is_remote_fs, is_directory, error);
if (monitor)
{