From: Ronan Pigott Date: Mon, 1 Jul 2024 21:07:28 +0000 (-0700) Subject: path: drop IN_ATTRIB from parent directory watches X-Git-Tag: v257-rc1~948 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bf8c7d83dcffffa55b5f534fb98db6b01315dc1;p=thirdparty%2Fsystemd.git path: drop IN_ATTRIB from parent directory watches When watching a given pathspec, systemd unconditionally installs IN_ATTRIB watches to track the link count of the resolved file. This way, we are notified if the watched path disappears, even if the resolved file inode is not removed. Similarly, systemd installs inotify watches on each parent directory, to be notified when the specified path appears. However, for these watches IN_ATTRIB is an unnecessary addition to the mask. In inotify, IN_ATTRIB on a directory is emitted whenever the attributes of any child changes, which, for many paths, has the potential to cause a high number of spurious wakeups in systemd. Let's remove IN_ATTRIB from the mask when installing watches on the parent directories of the specified path. --- diff --git a/src/core/path.c b/src/core/path.c index fdb6ca4cc9d..50f6db14709 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -81,7 +81,7 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) { tmp = *cut; *cut = '\0'; - flags = IN_MOVE_SELF | IN_DELETE_SELF | IN_ATTRIB | IN_CREATE | IN_MOVED_TO; + flags = IN_MOVE_SELF | IN_DELETE_SELF | IN_CREATE | IN_MOVED_TO; } else { cut = NULL; flags = flags_table[s->type];