[tracker-miners/wip/halfline/fanotify-fallback-fix] libtracker-miner: Properly detect fanotify failures
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/halfline/fanotify-fallback-fix] libtracker-miner: Properly detect fanotify failures
- Date: Mon, 2 May 2022 19:17:46 +0000 (UTC)
commit 94a189ee9b086c2f0105cfd80c6a61588f7ffe87
Author: Ray Strode <rstrode redhat com>
Date: Mon May 2 15:05:50 2022 -0400
libtracker-miner: Properly detect fanotify failures
commit 28142bdb5e3b96e0e7328322f3a880d97a6cdca0 makes
trackers file monitoring code fall back to GLib file monitors,
if fanotify doesn't work.
Unfortunately, fanotify_mark failures aren't propagated up,
so the fall back code doesn't get triggered in some cases.
This commit adds the plumbing to make the fall back code get
propagated.
src/libtracker-miner/tracker-monitor-fanotify.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-monitor-fanotify.c b/src/libtracker-miner/tracker-monitor-fanotify.c
index 7da262e89..9c6755d4a 100644
--- a/src/libtracker-miner/tracker-monitor-fanotify.c
+++ b/src/libtracker-miner/tracker-monitor-fanotify.c
@@ -107,6 +107,7 @@ enum {
static GInitableIface *initable_parent_iface = NULL;
static void tracker_monitor_fanotify_initable_iface_init (GInitableIface *iface);
+static void monitored_file_free (MonitoredFile *data);
G_DEFINE_TYPE_WITH_CODE (TrackerMonitorFanotify, tracker_monitor_fanotify,
TRACKER_TYPE_MONITOR_GLIB,
@@ -559,7 +560,7 @@ tracker_monitor_fanotify_get_property (GObject *object,
}
}
-static void
+static gboolean
add_mark (TrackerMonitorFanotify *monitor,
GFile *file)
{
@@ -573,9 +574,11 @@ add_mark (TrackerMonitorFanotify *monitor,
AT_FDCWD,
path) < 0) {
g_warning ("Could not add mark for path '%s': %m", path);
+ return FALSE;
}
g_free (path);
+ return TRUE;
}
static void
@@ -606,6 +609,7 @@ monitored_file_new (TrackerMonitorFanotify *monitor,
gchar *path;
struct statfs buf;
int mntid;
+ gboolean mark_added = FALSE;
path = g_file_get_path (file);
@@ -647,11 +651,16 @@ retry:
data->file = g_object_ref (file);
data->monitor = monitor;
memcpy (&data->handle.fsid, &buf.f_fsid, sizeof(fsid_t));
- add_mark (monitor, file);
+ mark_added = add_mark (monitor, file);
g_free (path);
data->handle_bytes = create_bytes_for_handle (&data->handle);
+ if (!mark_added) {
+ monitored_file_free (data);
+ data = NULL;
+ }
+
return data;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]