[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:09:55 +0000 (UTC)
commit 37cfabfa38ccf214a16ded24100534da9dd5b3e8
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 | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-monitor-fanotify.c b/src/libtracker-miner/tracker-monitor-fanotify.c
index 7da262e89..a83a159c2 100644
--- a/src/libtracker-miner/tracker-monitor-fanotify.c
+++ b/src/libtracker-miner/tracker-monitor-fanotify.c
@@ -559,7 +559,7 @@ tracker_monitor_fanotify_get_property (GObject *object,
}
}
-static void
+static gboolean
add_mark (TrackerMonitorFanotify *monitor,
GFile *file)
{
@@ -573,9 +573,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 +608,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 +650,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) {
+ monitor_file_free (data);
+ data = NULL;
+ }
+
return data;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]